File description

Background

(Hu et al. 2018, Nat. Comm).

Input

The analysis of the bacteria communities in R requires the following input files:
- Design table: Database_S1.txt
- Count table: bacteria_DAT100.tab
- Taxonomy table: bacteria_TAXA100.tab

SetUp

Load the required packages and functions.

Design table

This is how the design table looks like:

## # A tibble: 3 × 24
##   location days  background genotype compartment root_type   rep field_ID
##   <fct>    <chr> <fct>      <fct>    <fct>       <chr>     <dbl> <chr>   
## 1 Changins 90    B73        WT       rhizo       no            3 48      
## 2 Changins 90    no         no       soil        no            4 S3      
## 3 Changins 90    B73        bx1      root        no            4 65      
## # ℹ 16 more variables: DNA_extract_ID <chr>, MiSeq_bac <chr>,
## #   padding_seq_bac <chr>, bc_799F_ID <chr>, bc_799F_seq <chr>,
## #   bc_1193R_ID <chr>, bc_1193R_seq <chr>, sample_ID_bac <chr>,
## #   MiSeq_fungi <chr>, padding_seq_fun <chr>, bc_ITS1F_ID <chr>,
## #   bc_ITS1F_seq <chr>, bc_ITS2_ID <chr>, bc_ITS2_seq <chr>,
## #   sample_ID_fun <chr>, groups <fct>

Count table

## # A tibble: 6 × 24
##   location days  background genotype compartment root_type   rep field_ID
##   <fct>    <chr> <fct>      <fct>    <fct>       <chr>     <dbl> <chr>   
## 1 Changins 90    B73        WT       rhizo       no            3 48      
## 2 Changins 90    no         no       soil        no            4 S3      
## 3 Changins 90    B73        bx1      root        no            4 65      
## 4 Changins 90    B73        WT       root        no            3 48      
## 5 Changins 90    B73        WT       root        no            5 97      
## 6 Changins 90    no         no       soil        no            3 S2      
## # ℹ 16 more variables: DNA_extract_ID <chr>, MiSeq_bac <chr>,
## #   padding_seq_bac <chr>, bc_799F_ID <chr>, bc_799F_seq <chr>,
## #   bc_1193R_ID <chr>, bc_1193R_seq <chr>, sample_ID_bac <chr>,
## #   MiSeq_fungi <chr>, padding_seq_fun <chr>, bc_ITS1F_ID <chr>,
## #   bc_ITS1F_seq <chr>, bc_ITS2_ID <chr>, bc_ITS2_seq <chr>,
## #   sample_ID_fun <chr>, groups <fct>

This is how the count table looks like:

##      BACT10_sheffield BACT11_sheffield BACT12_sheffield BACT13_sheffield
## ASV1                0                0                0                0
## ASV2                0                0                0                0
## ASV3                0                0                0                0
## ASV4                0                0                0                0
## ASV5              718              316              928             1297
##      BACT14_sheffield
## ASV1                0
## ASV2                0
## ASV3                0
## ASV4                0
## ASV5             1343

Taxonomy table

This is how the taxonomy table looks like:

##              phylum                 order       genus
## ASV1 Proteobacteria       Pseudomonadales Pseudomonas
## ASV2 Proteobacteria Betaproteobacteriales   Pelomonas
## ASV3 Proteobacteria      Sphingomonadales Sphingobium
## ASV4 Proteobacteria       Pseudomonadales Pseudomonas
## ASV5     Firmicutes            Bacillales    Bacillus

Feedback experiment

The field experiment consisted of a total of 20 samples representing 2 sample groups (WT roots in BX+ and BX- soils). The number of replicates for all sample groups is given below.

Experimental design

groups_genotype_compartment_location_background_root_type Samples
bx1_rhizo_Changins_B73_no 7
bx1_rhizo_Ithaca_W22_no 8
bx1_rhizo_Zurich_B73_no 12
bx1_rhizo_Zurich_W22_no 12
bx1_root_Changins_B73_no 7
bx1_root_Ithaca_W22_no 7
bx1_root_Sheffield_W22_crown 8
bx1_root_Sheffield_W22_primary 8
bx1_root_Zurich_B73_no 12
bx1_root_Zurich_W22_no 12
bx1_soil_Ithaca_W22_no 8
bx1_soil_Zurich_B73_no 12
bx1_soil_Zurich_W22_no 12
bx2_rhizo_Ithaca_W22a_no 8
bx2_root_Ithaca_W22a_no 6
bx2_root_Sheffield_W22a_crown 8
bx2_root_Sheffield_W22a_primary 8
bx2_soil_Ithaca_W22a_no 8
bx6_rhizo_Ithaca_W22_no 8
bx6_root_Ithaca_W22_no 8
bx6_root_Sheffield_W22_crown 8
bx6_root_Sheffield_W22_primary 8
bx6_soil_Ithaca_W22_no 8
no_soil_Changins_no_no 10
no_soil_Sheffield_no_no 8
WT_rhizo_Changins_B73_no 10
WT_rhizo_Ithaca_W22_no 8
WT_rhizo_Zurich_B73_no 11
WT_rhizo_Zurich_W22_no 6
WT_root_Changins_B73_no 10
WT_root_Ithaca_W22_no 6
WT_root_Sheffield_W22_crown 8
WT_root_Sheffield_W22_primary 8
WT_root_Zurich_B73_no 11
WT_root_Zurich_W22_no 6
WT_soil_Ithaca_W22_no 8
WT_soil_Zurich_B73_no 11
WT_soil_Zurich_W22_no 6
## data normalization
# total sum as %
bDAT_norm <- t(t(bDAT)/colSums(bDAT)) * 100
bDAT_norm <- bDAT_norm[rowSums(bDAT_norm) > 0,]  
# dim(bDAT_norm)

# rarefication with library(vegan)
set.seed(3920)     # 3920 = zip code of Zermatt with lovely Matterhorn
bDAT_rare <- t(vegan::rrarefy(t(bDAT), min(colSums(bDAT_norm))))

## Phyloseq object
# library(phyloseq)
# library(ggplot2)
# library(plyr)
all_phy <- phyloseq(sample_data(design), 
                      otu_table(bDAT_norm, taxa_are_rows=T), 
                      tax_table(as.matrix(bTAX[rownames(bDAT_norm),])) )
all_phy_psmelt <- psmelt(all_phy)
dir.create("../Output/II_Field_soils", recursive = T, showWarnings = F)
#write_rds(design, "../Output/II_Field_soils/design.rds")
#write_rds(bDAT_norm, "../Output/II_Field_soils/bDAT_norm.rds")
#write_rds(all_phy_psmelt, "../Output/II_Field_soils/all_phy_psmelt.rds")

Mapping bacterial isolates to microbiota members

# ### uploading isolate-OTU assignments
iso.tab <- read.csv("../Input/II_Field_soils/hits97_field.csv")

colnames(iso.tab) <- c("nr", "ASV", "Strain", "%")
iso.tab$Strain <- gsub("_27f", "", iso.tab$Strain)
iso.tab$Strain <- gsub("_1492r", "", iso.tab$Strain)

LMX92 & LMX9231 were in the wrong direction in the sequences used for the mapping, but they are almost 100 % similar to LME3, therefore it will be the same mapping result.

LME3 <- iso.tab %>% filter(Strain %in% "LME3")
LMX92 <- LME3 %>% mutate(Strain = gsub("LME3", "LMX92", Strain))
LMX9231 <- LME3 %>% mutate(Strain = gsub("LME3", "LMX9231", Strain))

iso.tab <- rbind(iso.tab, LMX9231, LMX92)
iso.tab %<>% filter(!Strain %in% c("LAT1", "LBH1", "LBH4", "LBH6", "LTA5", "LWH2", "LWH6", "LWO4", NA))

head(iso.tab) %>% pander()
nr ASV Strain %
1 ASV1 LMX11 1
2 ASV1 LMX4 1
3 ASV1 LMX9 1
11 ASV1 LBN5 1
12 ASV1 LMS3 1
14 ASV1 LPD11 0.9974
iso.tab <- iso.tab %>% dplyr::select("%", "Strain", "ASV")

iso_names <- names(table(iso.tab$ASV))[-1]

#write_rds(iso.tab, "../Output/II_Field_soils/iso.tab.rds")
#write_rds(iso_names, "../Output/II_Field_soils/iso_names.rds")
# design <- read_rds("design.rds")
# bDAT_norm <- read_rds("bDAT_norm.rds")
# all_phy_psmelt <- read_rds("all_phy_psmelt.rds")
# iso_names <- read_rds("iso_names.rds")

CHANGINS B73

Root bacterial communities on WT plants grown in BX+ and BX- soils

The 50 most abundant ZOTUs in the root compartment are presented in the rank abundance plot below.

Rhizosphere bacterial communities on WT plants grown in BX+ and BX- soils

Isolates mapped to microbiome

Isolates in root microbiome

strain_col <- rep("black", length(rownames(bDAT_norm_root_Ch_MEANs)))
names(strain_col) <- rownames(bDAT_norm_root_Ch_MEANs)
strain_col <- ifelse(names(strain_col)  %in% iso_names, "dodgerblue3","lightgrey")

Supplementary figure 600 x 1600

## rank abundance plot
# postscript("Field_rhizo_profile_norm_MEANs_bacteria.eps", paper="special", width=7, height=5, horizontal = FALSE)
# par(mar=c(11,4,4,4), oma=c(0,0,0,0))
# pdf("LAC11_is_ZOTU3257.pdf", height=4, width=5)
p <- barplot(t(bDAT_norm_root_Ch_MEANs)[,1:100], border=NA,
             col=c("gold2","palegreen3"), beside=T, las=2, ylim=c(0, 6), 
             cex.names=.75, main = "Changins roots",
             ylab=paste("relative abundance [%]",sep=" ") , xaxt="n")
# source("functions/staxlab.R")
staxlab(side=1, at=(p[1,]+p[2,])/2, labels=rownames(bDAT_norm_root_Ch_MEANs)[1:100], col=strain_col[1:100], srt=45, cex=1)
# legend
legend(x="topright", legend=colnames(bDAT_norm_root_Ch_MEANs), col=c("gold2","palegreen3"), bty="n", xpd=TRUE, inset=c(0,0), pch=19, cex=1)
# error bars
arrows(x0=p, y0=t(bDAT_norm_root_Ch_MEANs)[,1:100], y1=t(bDAT_norm_root_Ch_MEANs)[,1:100] + t(bDAT_norm_root_WT_Ch_SEs)[,1:100], angle=90, length=0.02, lwd=1)

# stats
# stats_mw <- ifelse(rownames(bDAT_norm_rhizo_Ch_MEANs) %in% field_rhizo_lrt_OTUs, "*","")
# text(y=(apply(bDAT_norm_rhizo_Ch_MEANs, 1, max)*1.75)[1:100], x=((p[1,] + p[2,])/2)[1:100], labels=stats_mw[1:100])
# dev.off()

Isolates in Rhizosphere microbiome

strain_col_rhizo <- rep("black", length(rownames(bDAT_norm_rhizo_Ch_MEANs)))
names(strain_col_rhizo) <- rownames(bDAT_norm_rhizo_Ch_MEANs)
strain_col_rhizo <- ifelse(names(strain_col_rhizo)  %in% iso_names, "dodgerblue3","lightgrey")

RECKENHOLZ B73

Root bacterial communities on WT plants grown in BX+ and BX- soils

The 50 most abundant ZOTUs in the root compartment are presented in the rank abundance plot below.

Rhizosphere bacterial communities on WT plants grown in BX+ and BX- soils

Isolates mapped to microbiome

Isolates in root microbiome

strain_col <- rep("black", length(rownames(bDAT_norm_root_Zh_MEANs)))
names(strain_col) <- rownames(bDAT_norm_root_Zh_MEANs)
strain_col <- ifelse(names(strain_col)  %in% iso_names, "dodgerblue3","lightgrey")
## rank abundance plot
# postscript("Field_rhizo_profile_norm_MEANs_bacteria.eps", paper="special", width=7, height=5, horizontal = FALSE)
# par(mar=c(11,4,4,4), oma=c(0,0,0,0))
# pdf("LAC11_is_ZOTU3257.pdf", height=4, width=5)
p <- barplot(t(bDAT_norm_root_Zh_MEANs)[,1:100], border=NA,
             col=c("gold2","palegreen3"), beside=T, las=2, ylim=c(0, 20), 
             cex.names=.75, main = "Zurich B73 roots",
             ylab=paste("relative abundance [%]",sep=" ") , xaxt="n")
# source("functions/staxlab.R")
staxlab(side=1, at=(p[1,]+p[2,])/2, labels=rownames(bDAT_norm_root_Zh_MEANs)[1:100], col=strain_col[1:100], srt=45, cex=1)
# legend
legend(x="topright", legend=colnames(bDAT_norm_root_Zh_MEANs), col=c("gold2","palegreen3"), bty="n", xpd=TRUE, inset=c(0,0), pch=19, cex=1)
# error bars
arrows(x0=p, y0=t(bDAT_norm_root_Zh_MEANs)[,1:100], y1=t(bDAT_norm_root_Zh_MEANs)[,1:100] + t(bDAT_norm_root_Zh_SEs)[,1:100], angle=90, length=0.02, lwd=1)

# stats
# stats_mw <- ifelse(rownames(bDAT_norm_rhizo_Zh_MEANs) %in% field_rhizo_lrt_OTUs, "*","")
# text(y=(apply(bDAT_norm_rhizo_Zh_MEANs, 1, max)*1.75)[1:100], x=((p[1,] + p[2,])/2)[1:100], labels=stats_mw[1:100])
# dev.off()

Isolates in Rhizosphere microbiome

strain_col_rhizo <- rep("black", length(rownames(bDAT_norm_rhizo_Zh_MEANs)))
names(strain_col_rhizo) <- rownames(bDAT_norm_rhizo_Zh_MEANs)
strain_col_rhizo <- ifelse(names(strain_col_rhizo)  %in% iso_names, "dodgerblue3","lightgrey")

RECKENHOLZ W22

Root bacterial communities on WT plants grown in BX+ and BX- soils

The 50 most abundant ZOTUs in the root compartment are presented in the rank abundance plot below.

Rhizosphere bacterial communities on WT plants grown in BX+ and BX- soils

Isolates mapped to microbiome

Isolates in root microbiome

strain_col <- rep("black", length(rownames(bDAT_norm_root_Zh_22_MEANs)))
names(strain_col) <- rownames(bDAT_norm_root_Zh_22_MEANs)
strain_col <- ifelse(names(strain_col)  %in% iso_names, "dodgerblue3","lightgrey")
## rank abundance plot
# postscript("Field_rhizo_profile_norm_MEANs_bacteria.eps", paper="special", width=7, height=5, horizontal = FALSE)
# par(mar=c(11,4,4,4), oma=c(0,0,0,0))
# pdf("LAC11_is_ZOTU3257.pdf", height=4, width=5)
p <- barplot(t(bDAT_norm_root_Zh_22_MEANs)[,1:100], border=NA,
             col=c("gold2","palegreen3"), beside=T, las=2, ylim=c(0, 30), 
             cex.names=.75, main = "Zurich W22 roots",
             ylab=paste("relative abundance [%]",sep=" ") , xaxt="n")
# source("functions/staxlab.R")
staxlab(side=1, at=(p[1,]+p[2,])/2, labels=rownames(bDAT_norm_root_Zh_22_MEANs)[1:100], col=strain_col[1:100], srt=45, cex=1)
# legend
legend(x="topright", legend=colnames(bDAT_norm_root_Zh_22_MEANs), col=c("gold2","palegreen3"), bty="n", xpd=TRUE, inset=c(0,0), pch=19, cex=1)
# error bars
arrows(x0=p, y0=t(bDAT_norm_root_Zh_22_MEANs)[,1:100], y1=t(bDAT_norm_root_Zh_22_MEANs)[,1:100] + t(bDAT_norm_root_Zh_22_SEs)[,1:100], angle=90, length=0.02, lwd=1)

# stats
# stats_mw <- ifelse(rownames(bDAT_norm_rhizo_Zh_22_MEANs) %in% field_rhizo_lrt_OTUs, "*","")
# text(y=(apply(bDAT_norm_rhizo_Zh_22_MEANs, 1, max)*1.75)[1:100], x=((p[1,] + p[2,])/2)[1:100], labels=stats_mw[1:100])
# dev.off()

Isolates in Rhizosphere microbiome

strain_col_rhizo <- rep("black", length(rownames(bDAT_norm_rhizo_Zh_22_MEANs)))
names(strain_col_rhizo) <- rownames(bDAT_norm_rhizo_Zh_22_MEANs)
strain_col_rhizo <- ifelse(names(strain_col_rhizo)  %in% iso_names, "dodgerblue3","lightgrey")

AURORA W22

Root bacterial communities on WT plants grown in BX+ and BX- soils

The 50 most abundant ZOTUs in the root compartment are presented in the rank abundance plot below.

Rhizosphere bacterial communities on WT plants grown in BX+ and BX- soils

Isolates mapped to microbiome

Isolates in root microbiome

strain_col <- rep("black", length(rownames(bDAT_norm_root_Au_22_MEANs)))
names(strain_col) <- rownames(bDAT_norm_root_Au_22_MEANs)
strain_col <- ifelse(names(strain_col)  %in% iso_names, "dodgerblue3","lightgrey")
## rank abundance plot
# postscript("Field_rhizo_profile_norm_MEANs_bacteria.eps", paper="special", width=7, height=5, horizontal = FALSE)
# par(mar=c(11,4,4,4), oma=c(0,0,0,0))
# pdf("LAC11_is_ZOTU3257.pdf", height=4, width=5)
p <- barplot(t(bDAT_norm_root_Au_22_MEANs)[,1:100], border=NA,
             col=c("gold2","palegreen3"), beside=T, las=2, ylim=c(0, 8), 
             cex.names=.75, main = "Aurora W22 roots",
             ylab=paste("relative abundance [%]",sep=" ") , xaxt="n")
# source("functions/staxlab.R")
staxlab(side=1, at=(p[1,]+p[2,])/2, labels=rownames(bDAT_norm_root_Au_22_MEANs)[1:100], col=strain_col[1:100], srt=45, cex=1)
# legend
legend(x="topright", legend=colnames(bDAT_norm_root_Au_22_MEANs), col=c("gold2","palegreen3"), bty="n", xpd=TRUE, inset=c(0,0), pch=19, cex=1)
# error bars
arrows(x0=p, y0=t(bDAT_norm_root_Au_22_MEANs)[,1:100], y1=t(bDAT_norm_root_Au_22_MEANs)[,1:100] + t(bDAT_norm_root_Au_22_SEs)[,1:100], angle=90, length=0.02, lwd=1)

# stats
# stats_mw <- ifelse(rownames(bDAT_norm_rhizo_Au_22_MEANs) %in% field_rhizo_lrt_OTUs, "*","")
# text(y=(apply(bDAT_norm_rhizo_Au_22_MEANs, 1, max)*1.75)[1:100], x=((p[1,] + p[2,])/2)[1:100], labels=stats_mw[1:100])
# dev.off()

Isolates in Rhizosphere microbiome

strain_col_rhizo <- rep("black", length(rownames(bDAT_norm_rhizo_Au_22_MEANs)))
names(strain_col_rhizo) <- rownames(bDAT_norm_rhizo_Au_22_MEANs)
strain_col_rhizo <- ifelse(names(strain_col_rhizo)  %in% iso_names, "dodgerblue3","lightgrey")

SHEFFIELD W22

Root bacterial communities on WT plants grown in BX+ and BX- soils

The 50 most abundant ZOTUs in the root compartment are presented in the rank abundance plot below.

Crown roots bacterial communities on WT plants grown in BX+ and BX- soils

primary roots bacterial communities on WT plants grown in BX+ and BX- soils

Isolates mapped to microbiome

Isolates in root microbiome

strain_col <- rep("black", length(rownames(bDAT_norm_root_Sh_22_MEANs)))
names(strain_col) <- rownames(bDAT_norm_root_Sh_22_MEANs)
strain_col <- ifelse(names(strain_col)  %in% iso_names, "dodgerblue3","lightgrey")
## rank abundance plot
# postscript("Field_Crown_profile_norm_MEANs_bacteria.eps", paper="special", width=7, height=5, horizontal = FALSE)
# par(mar=c(11,4,4,4), oma=c(0,0,0,0))
# pdf("LAC11_is_ZOTU3257.pdf", height=4, width=5)
p <- barplot(t(bDAT_norm_root_Sh_22_MEANs)[,1:100], border=NA,
             col=c("gold2","palegreen3"), beside=T, las=2, ylim=c(0, 2), 
             cex.names=.75, main = "Sheffield W22 roots",
             ylab=paste("relative abundance [%]",sep=" ") , xaxt="n")
# source("functions/staxlab.R")
staxlab(side=1, at=(p[1,]+p[2,])/2, labels=rownames(bDAT_norm_root_Sh_22_MEANs)[1:100], col=strain_col[1:100], srt=45, cex=1)
# legend
legend(x="topright", legend=colnames(bDAT_norm_root_Sh_22_MEANs), col=c("gold2","palegreen3"), bty="n", xpd=TRUE, inset=c(0,0), pch=19, cex=1)
# error bars
arrows(x0=p, y0=t(bDAT_norm_root_Sh_22_MEANs)[,1:100], y1=t(bDAT_norm_root_Sh_22_MEANs)[,1:100] + t(bDAT_norm_root_Sh_22_MEANs)[,1:100], angle=90, length=0.02, lwd=1)

# stats
# stats_mw <- ifelse(rownames(bDAT_norm_Crown_Sh_22_MEANs) %in% field_Crown_lrt_OTUs, "*","")
# text(y=(apply(bDAT_norm_Crown_Sh_22_MEANs, 1, max)*1.75)[1:100], x=((p[1,] + p[2,])/2)[1:100], labels=stats_mw[1:100])
# dev.off()

Isolates in Crownsphere microbiome

strain_col_Crown <- rep("black", length(rownames(bDAT_norm_Crown_Sh_22_MEANs)))
names(strain_col_Crown) <- rownames(bDAT_norm_Crown_Sh_22_MEANs)
strain_col_Crown <- ifelse(names(strain_col_Crown)  %in% iso_names, "dodgerblue3","lightgrey")

Isolates in primarysphere microbiome

strain_col_primary <- rep("black", length(rownames(bDAT_norm_primary_Sh_22_MEANs)))
names(strain_col_primary) <- rownames(bDAT_norm_primary_Sh_22_MEANs)
strain_col_primary <- ifelse(names(strain_col_primary)  %in% iso_names, "dodgerblue3","lightgrey")

Abundance psmelt

all_phy_psmelt_iso <- all_phy_psmelt %>% filter(root_type %in% c("no", "primary")) %>% 
                                                  dplyr::select(OTU, phylum, family, genus, Abundance, location, background, genotype,
                                                        compartment) %>% 
                                                       group_by(OTU, phylum, family, genus, location, background, genotype, compartment) %>% 
                                                       dplyr::summarise(Abundace_mean = mean(Abundance)) %>% 
                                                       dplyr::left_join(., iso.tab, by = c("OTU" = "ASV")) %>% 
                                                       # dplyr::select(-`%`) %>% 
                                                       unique()
#write_rds(all_phy_psmelt_iso, "../Output/II_Field_soils/all_phy_psmelt_iso.rds")

… stopped here… code has a problem Error: Problem with mutate() input Changins_B73_WT_root_rank. x Input Changins_B73_WT_root_rank can’t be recycled to size 1. i Input Changins_B73_WT_root_rank is 1:nrow(.). i Input Changins_B73_WT_root_rank must be size 1, not 26571. i The error occurred in group 1: OTU = “ASV1”, phylum = “Proteobacteria”, family = “Pseudomonadaceae”, genus = “Pseudomonas”.

# all_phy_psmelt_iso_group_abundance_rank <- all_phy_psmelt_iso_group_abundance %>% as.data.frame() %>% 
#   dplyr::select(-Strain, -Ithaca_W22_bx6_soil, -Ithaca_W22_bx6_rhizo, -Ithaca_W22_bx6_root, -Ithaca_W22a_bx2_soil, -Ithaca_W22a_bx2_rhizo,
#                 -Ithaca_W22a_bx2_root, -Sheffield_W22_bx6_root, -Sheffield_W22a_bx2_root) %>%  
#   dplyr::arrange(desc(Changins_B73_WT_rhizo)) %>% mutate(Changins_B73_WT_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Changins_B73_WT_root)) %>% mutate(Changins_B73_WT_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Changins_B73_bx1_rhizo)) %>% mutate(Changins_B73_bx1_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Changins_B73_bx1_root)) %>% mutate(Changins_B73_bx1_root_rank = 1:nrow(.)) %>%
#   dplyr::arrange(desc(Ithaca_W22_WT_soil)) %>% mutate(Ithaca_W22_WT_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Ithaca_W22_WT_rhizo)) %>% mutate(Ithaca_W22_WT_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Ithaca_W22_WT_root)) %>% mutate(Ithaca_W22_WT_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Ithaca_W22_bx1_soil)) %>% mutate(Ithaca_W22_bx1_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Ithaca_W22_bx1_rhizo)) %>% mutate(Ithaca_W22_bx1_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Ithaca_W22_bx1_root)) %>% mutate(Ithaca_W22_bx1_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_WT_soil)) %>% mutate(Zurich_B73_WT_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_WT_rhizo)) %>% mutate(Zurich_B73_WT_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_WT_root)) %>% mutate(Zurich_B73_WT_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_bx1_soil)) %>% mutate(Zurich_B73_bx1_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_bx1_rhizo)) %>% mutate(Zurich_B73_bx1_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_B73_bx1_root)) %>% mutate(Zurich_B73_bx1_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_WT_soil)) %>% mutate(Zurich_W22_WT_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_WT_rhizo)) %>% mutate(Zurich_W22_WT_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_WT_root)) %>% mutate(Zurich_W22_WT_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_bx1_soil)) %>% mutate(Zurich_W22_bx1_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_bx1_rhizo)) %>% mutate(Zurich_W22_bx1_rhizo_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Zurich_W22_bx1_root)) %>% mutate(Zurich_W22_bx1_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Sheffield_no_no_soil)) %>% mutate(Sheffield_no_no_soil_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Sheffield_W22_WT_root)) %>% mutate(Sheffield_W22_WT_root_rank = 1:nrow(.)) %>% 
#   dplyr::arrange(desc(Sheffield_W22_bx1_root)) %>% mutate(Sheffield_W22_bx1_root_rank = 1:nrow(.)) 
# 
# all_phy_psmelt_iso_group_abundance_rank_iso <- all_phy_psmelt_iso_group_abundance_rank %>% 
#   dplyr::left_join(., iso.tab, by = c("OTU" = "ZOTU")) %>% dplyr::select(-`%`) %>% unique()
# 
# all_phy_psmelt_iso_group_abundance_rank <- all_phy_psmelt_iso_group_abundance_rank_iso %>%
#   mutate(Isolate = case_when(Strain != "NA" ~ TRUE, Strain %in% NA ~ FALSE))
# all_phy_psmelt_iso_group_abundance_rank_iso %>% dplyr::select(OTU, phylum, family, genus, BXp_feedback_WT_Root_Rank, BXm_feedback_WT_Root_Rank, Strain) %>% filter(Strain != "NA") %>% knitr::kable()
# all_phy_psmelt_iso_group_abundance_rank %>% dplyr::select(OTU, phylum, family, genus, BXp_feedback_WT_Root_Rank, BXm_feedback_WT_Root_Rank, Isolate) %>% unique() %>% dplyr::arrange(BXp_feedback_WT_Root_Rank) %>% as.data.frame() %>% slice_head(n = 100) %>%  knitr::kable() 
# write_rds(all_phy_psmelt_iso_group_abundance_rank_iso, "all_phy_psmelt_iso_group_abundance_rank_iso_Hu_et_al_FB.rds")
# write_rds(all_phy_psmelt_iso_group_abundance_rank, "all_phy_psmelt_iso_group_abundance_rank_Hu_et_al_FB.rds")

BX colonization psmelt - read rds

# design <- read_rds("design.rds")
# bDAT_norm <- read_rds("bDAT_norm.rds")
# all_phy_psmelt <- read_rds("all_phy_psmelt.rds")
# iso.tab <- read_rds("iso.tab.rds")
# iso_names <- read_rds("iso_names.rds")

BX abundance isolates

For MRB tree Fig. 1A and for correlations Fig 5A&B “all_phy_psmelt_iso_BX_abundance.rds”

# the computation of these two commands takes a lot of time and therefore the file is saved as rds and then read as rds back into R

# # select the columns and the root type
all_phy_psmelt_BX <- all_phy_psmelt %>% filter(root_type %in% c("no", "primary")) %>%
                                                  dplyr::select(OTU, Sample, rep, phylum, family, genus, Abundance, location, background,
                                                       genotype, compartment)

# Calculate BX colonization (WT/bx1 ratio and Log fold change (log2FC = log2(WT)-log2(bx1))) and join to isolates
all_phy_psmelt_iso_BX_abundance <- all_phy_psmelt_BX %>% 
  filter(OTU %in% iso_names) %>% 
  filter(genotype %in% c("WT", "bx1")) %>% 
  dplyr::select(-Sample) %>% 
  filter(OTU %in% iso_names) %>% 
  pivot_wider(names_from = 9, values_from = Abundance, values_fn = mean) %>% 
  mutate(WT = replace_na(WT, 0), bx1 = replace_na(bx1, 0)) %>% 
  mutate(BXcol = WT/bx1, log2FC = log2(WT)-log2(bx1), WTbx1dif = WT - bx1, WTbx1dif_zscore = bx1 - WT / sd(WT)) %>% 
  left_join(iso.tab, by = c("OTU" = "ASV")) %>% 
  dplyr::select(-`%`)

all_phy_psmelt_iso_BX <- all_phy_psmelt_BX %>% 
  filter(OTU %in% iso_names) %>% 
  filter(genotype %in% c("WT", "bx1")) %>% 
  dplyr::select(-Sample) %>% 
  filter(OTU %in% iso_names) %>% 
  left_join(iso.tab, by = c("OTU" = "ASV")) %>% 
  dplyr::select(-`%`)

# write rds
#write_rds(all_phy_psmelt_iso_BX_abundance, "../Output/II_Field_soils/all_phy_psmelt_iso_BX_abundance.rds")
#write_rds(all_phy_psmelt_BX, "../Output/II_Field_soils/all_phy_psmelt_BX.rds")
# all_phy_psmelt_iso_BX_abundance <- read_rds("all_phy_psmelt_iso_BX_abundance.rds")
# 
# all_phy_psmelt_BX_abundance <- read_rds("all_phy_psmelt_BX_abundance.rds")
all_phy_psmelt_iso_BX_abundance_meanOTU <- all_phy_psmelt_iso_BX_abundance %>% group_by(OTU, family, location, background, compartment, Strain) %>% dplyr::summarize(WT_mean = mean(WT), bx1_mean = mean(bx1), BXcol_mean = mean(BXcol), log2FC_mean = mean(log2FC), WTbx1dif_mean = mean(WTbx1dif))

all_phy_psmelt_iso_BX_abundance_meanOTU$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_abundance_meanOTU$family)

#write_rds(all_phy_psmelt_iso_BX_abundance_meanOTU, "../Output/II_Field_soils/all_phy_psmelt_iso_BX_abundance_meanOTU.rds")
# all_phy_psmelt_iso_BX_abundance %>% ggplot(aes(x = OTU, y = log2FC)) +
#   geom_point(aes(colour = family))
# all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
#   filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
#   ggplot(aes(x = OTU, y = log2FC_OTU)) +
#   geom_point(aes(colour = family)) +
#   facet_wrap(interaction(location, background) ~ compartment)
# all_phy_psmelt_iso_BX_abundance %>% 
#   # filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
#   ggplot(aes(x = OTU, y = WTbx1dif)) +
#   geom_point(aes(colour = family)) +
#   facet_wrap(interaction(location, background) ~ compartment)
all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
  # filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
  filter(!WTbx1dif_mean %in% "0") %>% 
  ggplot(aes(x = OTU, y = WTbx1dif_mean)) +
  geom_point(aes(colour = family)) +
  facet_wrap(interaction(location, background) ~ compartment)

# all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
#   filter(family %in% "Sphingomonadaceae") %>% 
#   filter(location %in% "Changins") %>% 
#   filter(!WTbx1dif_mean %in% 0) %>% 
#   unique() %>% 
#   # filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
#   ggplot(aes(x = OTU, y = WTbx1dif_mean)) +
#   geom_point(aes(colour = WT_mean)) +
#   facet_wrap(interaction(location, background) ~ compartment) +
#   theme(axis.text.x=element_text(angle = 90, hjust = 0, vjust = 0.5)) 
# all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
#   filter(location %in% "Changins") %>% 
#   # filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
#   ggplot(aes(x = OTU, y = log2FC_OTU)) +
#   geom_point(aes(colour = family)) +
#   facet_wrap(interaction(location, background) ~ compartment)
# all_phy_psmelt_iso_BX_abundance %>% 
#   filter(location %in% "Changins") %>% 
#   # filter(!log2FC_OTU %in% c(-Inf, Inf, NA, NaN)) %>% 
#   ggplot(aes(x = OTU, y = log2FC)) +
#   geom_point(aes(colour = family)) +
#   facet_wrap(interaction(location, background) ~ compartment)
# all_phy_psmelt_iso_BX_abundance %>% filter(log2FC %in% c(-Inf, Inf, NA, NaN))
# all_phy_psmelt_iso_BX_abundance %<>% as.data.frame() %>% dplyr::mutate(WT = replace_na(WT, 0))
# 
# all_phy_psmelt_iso_BX_abundance_cum <- all_phy_psmelt_iso_BX_abundance %>% filter(compartment %in% "root") %>% dplyr::select(-rep) %>% group_by(OTU, Strain, location, background, compartment) %>% dplyr::summarize(Abundance_mean_Strain = mean(WT))
# 
# all_phy_psmelt_iso_BX_abundance_cum <- all_phy_psmelt_iso_BX_abundance_cum %>% group_by(Strain, location, background, compartment) %>% dplyr::summarize(Abundance_cum_Strain = sum(Abundance_mean_Strain))
# 
# all_phy_psmelt_iso_BX_abundance_cum %>% 
#   ggplot(aes(x = Strain, y = Abundance_cum_Strain, group = location)) + 
#   geom_bar(aes(fill = location), stat = "identity") + 
#   facet_wrap(~location) + 
#   theme_bw()+
#   theme(axis.text.x=element_text(angle = 90, hjust = 0, vjust = 0.5 ))
# 
# 
# all_phy_psmelt_iso_BX_abundance_cum %>% 
#   filter(location %in% "Changins") %>% 
#   ggplot(aes(x = Strain, y = Abundance_cum_Strain, group = location)) + 
#   geom_bar(aes(fill = location), stat = "identity") + 
#   facet_wrap(~location) + 
#   theme_bw()+
#   theme(axis.text.x=element_text(angle = 90, hjust = 0, vjust = 0.5 ))
# 
# write_rds(all_phy_psmelt_iso_BX_abundance_cum, "all_phy_psmelt_iso_BX_abundance_cum.rds")
# all_phy_psmelt_iso_BX_abundance <- read_rds("all_phy_psmelt_iso_BX_abundance.rds")
strains <- c("LMZ1", "LMX92", "LMX9231", "LMC1", "LMK1", "LME3", "LAC11", "LWO15", "LPD12", "LMX9", "LPD11", "LMX4", "LMX11", "LMY1", "LWO6", "LPB4.O", "LPD21", "LPD2", "LST26", "LPD22", "LPD32", "LPD121", "LPD34", "LPD33", "LMS1", "LMU1", "LST72", "LST61", "LST521", "LST82", "LST21", "LST22", "LST28", "LST18", "LST23", "LST52", "LST24", "LST15", "LST16", "LST14", "LST25", "LST20", "LST17", "LST27", "LST60", "LST19", "LST11", "LST12", "LST13", "LRH8.O", "LRC7.O", "LRH11", "LRH12", "LRH13", "LRC7.S", "LMQ1", "LSP13", "LMC3", "LWH4", "LBH3", "LMA1", "LWS12", "LBO6", "LBO4", "LWS2", "LWH9", "LBH2", "LWH8", "LBH7", "LDE1", "LBA112", "LBA18", "LBA111", "LBA1", "LWS1", "LWS15", "LMH1", "LBA71", "LMW1", "LMJ1", "LBA3", "LWS11", "LMA2", "LMO1", "LBA20", "LBA21", "LMM1", "LMP1", "LME1", "LME2", "LMX8", "LMX1", "LPE13", "LMF1", "LMG1", "LMG2", "LMV1", "LPA21", "LMX5", "LBS1", "LMD1", "LMD2", "LAR12", "LPA2", "LWH5", "LAR21", "LML1", "LWH1", "LWO8", "LWH3", "LBO1", "LWH7", "LWO2", "LMI12", "LMI21", "LWS13", "LMI1", "LMX2", "LMX6", "LMI22", "LMI18", "LWH10", "LMI14", "LMX7", "LMB2", "LMI11", "LMI1x", "LMI2x", "LWO5", "LWH12", "LWO13", "LWH13", "LWO12", "LMI51", "LBO3", "LMX3", "LMI15", "LMI13", "LMI111", "LMI112", "LMI81", "LMI32", "LMI62", "LMI522", "LMI17", "LMI121", "LWH11", "LWO14", "LBO11", "LMT1", "LMN1")
# scales::show_col(calc_pal()(12))
# all_phy_psmelt_iso_BX_abundance %<>% na.omit()
# 
# all_phy_psmelt_iso_BX_abundance$cols_family <- as.character(all_phy_psmelt_iso_BX_abundance$family)
# 
# all_phy_psmelt_iso_BX_abundance[all_phy_psmelt_iso_BX_abundance$family=="Bacillaceae" , ]$cols_family <- "#004586"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Chitinophagaceae" , ]$cols_family <- "#ff420e"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Enterobacteriaceae" , ]$cols_family <- "#ffd320"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Erwiniaceae" , ]$cols_family <- "#579d1c"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Microbacteriaceae" , ]$cols_family <- "#7e0021"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Micrococcaceae" , ]$cols_family <- "#83caff"
# #all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Nocardioidaceae" , ]$cols_family <- "#314004"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Oxalobacteraceae" , ]$cols_family <- "#aecf00"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Burkholderiaceae" , ]$cols_family <- "#aecf00"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Pseudomonadaceae" , ]$cols_family <- "#4b1f6f"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Rhizobiaceae", ]$cols_family <- "#ff950e"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Sphingomonadaceae", ]$cols_family <- "#c5000b"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Xanthomonadaceae", ]$cols_family <- "#0084d1"
# 
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Streptomycetaceae" , ]$cols_family <- "#8b995a"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Flavobacteriaceae" , ]$cols_family <- "#F0D5B4"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Paenibacillaceae" , ]$cols_family <- "#8f9ec9"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Planococcaceae", ]$cols_family <- "#7F5757"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Chitinophagaceae", ]$cols_family <- "#6D4600"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Moraxellaceae", ]$cols_family <- "#a73e62"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Sphingobacteriaceae", ]$cols_family <- "#c75536"
# all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family=="Deinococcaceae", ]$cols_family <- "#031e33"
# 
# # all_phy_psmelt_iso_BX_abundance[ all_phy_psmelt_iso_BX_abundance$family==NA, ]$cols_family <- "dimgrey"
# # table(all_phy_psmelt_iso_BX_abundance$cols_family)
# 
# ## collapsed color vector for each level
# temp <- data.frame(all_phy_psmelt_iso_BX_abundance$family, all_phy_psmelt_iso_BX_abundance$cols_family)
# temp <- plyr::ddply(temp, .variables="all_phy_psmelt_iso_BX_abundance.cols_family", .fun=unique)   #library(plyr)
# all_phy_psmelt_iso_BX_abundance_level_cols_family <- as.character(temp[,2])
# names(all_phy_psmelt_iso_BX_abundance_level_cols_family) <- temp[,1]

Some strains do not match an ASV or the ASV has in one of the genotypes and abundance = 0, these families are excluded in this plot: - Chitinophagaceae - Deinococcaceae - Moraxellaceae - Nocardioidaceae - Sphingobacteriaceae

Fig. 2A BX Tolerance: BX dependent colonization 630 x 600

# all_phy_psmelt_iso_BX_abundance %>% 
#   filter(Strain %in% strains) %>% 
#   filter(compartment %in% c("rhizo", "root")) %>% 
#   filter(location %in% "Changins") %>% 
#   # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
#   # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
#   filter(!log2FC %in% c(-Inf, Inf, NA, NaN)) %>% 
#   # filter(!log2FC %in% c(NA, NaN)) %>% 
#   mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
#   mutate(OTU = reorder(OTU, desc(family))) %>% 
#   # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
#   ggplot(aes(y = log2FC, x = OTU)) + 
#   geom_point(aes(color=family, shape = compartment), size = 3, stat = "summary", show.legend = TRUE) +
#   geom_hline(yintercept = 0) +
#   coord_flip() +
#   theme_bw() +
#   scale_shape_manual(values=c(15, 16, 17, 18)) +
#   scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_level_cols_family) +
#   labs(x = "",
#        y = "log2 fold change WT-bx1",
#        shape = "compartment")
# all_phy_psmelt_iso_BX_abundance %>% 
#   filter(Strain %in% strains) %>% 
#   filter(compartment %in% c("rhizo", "root")) %>% 
#   filter(location %in% "Changins") %>% 
#   # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
#   # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
#   filter(!WTbx1dif_zscore  %in% c(-Inf, Inf, NA, NaN)) %>% 
#   # filter(!log2FC %in% c(NA, NaN)) %>% 
#   mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
#   mutate(OTU = reorder(OTU, desc(family))) %>% 
#   # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
#   ggplot(aes(y = WTbx1dif_zscore , x = OTU)) + 
#   geom_point(aes(color=family, shape = compartment), size = 3, stat = "summary", show.legend = TRUE) +
#   geom_hline(yintercept = 0) +
#   coord_flip() +
#   theme_bw() +
#   scale_shape_manual(values=c(15, 16, 17, 18)) +
#   scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_level_cols_family) +
#   labs(x = "",
#        y = "zscore WT-bx1",
#        shape = "compartment")
# scales::show_col(calc_pal()(12))
# all_phy_psmelt_iso_BX_abundance_meanOTU %<>% na.omit()

all_phy_psmelt_iso_BX_abundance_meanOTU$cols_family <- as.character(all_phy_psmelt_iso_BX_abundance_meanOTU$family)

all_phy_psmelt_iso_BX_abundance_meanOTU[all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Bacillaceae" , ]$cols_family <- "#004586"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Chitinophagaceae" , ]$cols_family <- "#ff420e"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Enterobacteriaceae" , ]$cols_family <- "#ffd320"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Erwiniaceae" , ]$cols_family <- "#579d1c"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Microbacteriaceae" , ]$cols_family <- "#7e0021"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Micrococcaceae" , ]$cols_family <- "#83caff"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Nocardioidaceae" , ]$cols_family <- "#314004"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Oxalobacteraceae" , ]$cols_family <- "#aecf00"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Burkholderiaceae" , ]$cols_family <- "#aecf00"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Pseudomonadaceae" , ]$cols_family <- "#4b1f6f"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Rhizobiaceae", ]$cols_family <- "#ff950e"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Sphingomonadaceae", ]$cols_family <- "#c5000b"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Xanthomonadaceae", ]$cols_family <- "#0084d1"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Streptomycetaceae" , ]$cols_family <- "#8b995a"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Flavobacteriaceae" , ]$cols_family <- "#F0D5B4"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Paenibacillaceae" , ]$cols_family <- "#8f9ec9"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Planococcaceae", ]$cols_family <- "#7F5757"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Chitinophagaceae", ]$cols_family <- "#6D4600"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Moraxellaceae", ]$cols_family <- "#a73e62"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Sphingobacteriaceae", ]$cols_family <- "#c75536"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Deinococcaceae", ]$cols_family <- "#031e33"
all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family=="Weeksellaceae" , ]$cols_family <- "black"

# all_phy_psmelt_iso_BX_abundance_meanOTU[ all_phy_psmelt_iso_BX_abundance_meanOTU$family==NA, ]$cols_family <- "dimgrey"
# table(all_phy_psmelt_iso_BX_abundance_meanOTU$cols_family)

## collapsed color vector for each level
temp <- data.frame(all_phy_psmelt_iso_BX_abundance_meanOTU$family, all_phy_psmelt_iso_BX_abundance_meanOTU$cols_family)
temp <- plyr::ddply(temp, .variables="all_phy_psmelt_iso_BX_abundance_meanOTU.cols_family", .fun=unique)   #library(plyr)
all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family <- as.character(temp[,2])
names(all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) <- temp[,1]
# all_phy_psmelt_iso_BX_abundance_meanOTU_meanOTU$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_abundance_meanOTU$family)

ASV_WTbx1dif <- all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  filter(!WTbx1dif_mean  %in% 0) %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif_mean, x = reorder(OTU, desc(family)))) + 
  geom_point(aes(color=family, shape = compartment), size = 3, stat = "summary", show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  scale_shape_manual(values=c(15, 16, 17, 18)) +
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WTbx1dif_mean",
       shape = "compartment")

ASV_WTbx1dif

# library(Cairo)
# 
# Cairo(file="ASV_WTbx1dif.png",
#       type="png",
#       units="in",
#       height = 20,
#       width = 10,
#       pointsize = 1,
#       dpi=300)
# ASV_WTbx1dif
# dev.off()
# all_phy_psmelt_iso_BX_abundance_meanOTU_meanOTU$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_abundance_meanOTU$family)

ASV_WTbx1dif_OTU <- all_phy_psmelt_iso_BX_abundance_meanOTU %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  filter(!WTbx1dif_mean  %in% 0) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif_mean, x = family)) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_WTbx1dif_OTU

library(Cairo)
# 
# Cairo(file="ASV_WTbx1dif_OTU.png",
#       type="png",
#       units="in",
#       height = 20,
#       width = 10,
#       pointsize = 1,
#       dpi=300)
# ASV_WTbx1dif_OTU
# dev.off()

Select only well represented ASVs

count_sample_ASV <- all_phy_psmelt_iso_BX %>% filter(!Abundance %in% 0) %>% dplyr::select(OTU, rep, background, compartment, genotype, location, family) %>% group_by(OTU, background, compartment, genotype, location, family)  %>% unique() %>% count()

count_sample_ASV %>% filter(OTU %in% "ASV2230")
## # A tibble: 3 × 7
## # Groups:   OTU, background, compartment, genotype, location, family [3]
##   OTU     background compartment genotype location family                n
##   <chr>   <fct>      <fct>       <fct>    <fct>    <chr>             <int>
## 1 ASV2230 B73        rhizo       WT       Changins Streptomycetaceae     1
## 2 ASV2230 B73        root        WT       Changins Streptomycetaceae     2
## 3 ASV2230 B73        root        bx1      Changins Streptomycetaceae     1
count_sample_ASV_well_represented <- count_sample_ASV %>% filter(location %in% "Changins") %>% filter(compartment %in% "root") %>%  filter(n > 2)
represented_OTU <- count_sample_ASV_well_represented$OTU %>% unique()
all_phy_psmelt_iso_BX_abundance$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_abundance$family)

ASV_WTbx1dif_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% represented_OTU) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  filter(!WTbx1dif  %in% 0) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_WTbx1dif_OTU

min. samples per treatment in dataset are 6 (soil, rhizo, root W22 WT Zurich and root WT W22 Ithaca), max are 12 (soil, rhizo, root bx1 W22 Zurich)

nr_of_samples_per_treatment <- all_phy_psmelt_iso_BX %>%
  dplyr::select(rep, background, compartment, genotype, location) %>% 
  group_by(background, compartment, genotype, location)  %>% 
  unique() %>% 
  count()

nr_of_samples_per_treatment$n %>% max()
## [1] 12
nr_of_samples_per_treatment$n %>% min()
## [1] 6
nr_of_samples_per_treatment %>% knitr::kable()
background compartment genotype location n
B73 soil WT Zurich 11
B73 soil bx1 Zurich 12
B73 rhizo WT Changins 10
B73 rhizo WT Zurich 11
B73 rhizo bx1 Changins 7
B73 rhizo bx1 Zurich 12
B73 root WT Changins 10
B73 root WT Zurich 11
B73 root bx1 Changins 7
B73 root bx1 Zurich 12
W22 soil WT Ithaca 8
W22 soil WT Zurich 6
W22 soil bx1 Ithaca 8
W22 soil bx1 Zurich 11
W22 rhizo WT Ithaca 8
W22 rhizo WT Zurich 6
W22 rhizo bx1 Ithaca 8
W22 rhizo bx1 Zurich 11
W22 root WT Ithaca 6
W22 root WT Zurich 6
W22 root WT Sheffield 8
W22 root bx1 Ithaca 7
W22 root bx1 Zurich 11
W22 root bx1 Sheffield 8
count_sample_ASV <- all_phy_psmelt_iso_BX %>% 
  filter(!Abundance %in% 0) %>% 
  dplyr::select(OTU, rep, background, compartment, genotype, location, family) %>% 
  group_by(OTU, background, compartment, genotype, location, family)  %>% unique() %>% count()

count_sample_ASV_in_all_samples <- count_sample_ASV %>% filter(location %in% "Changins") %>% filter(compartment %in% "root") %>%  filter(n > 5)
ASV_in_all_samples <- count_sample_ASV_in_all_samples$OTU %>% unique()
all_phy_psmelt_iso_BX_abundance$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_abundance$family)

ASV_WTbx1dif_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% ASV_in_all_samples) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  filter(!WTbx1dif  %in% 0) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_WTbx1dif_OTU

###best mapping ASVs

all_phy_psmelt_iso_BX_identity_strains <- all_phy_psmelt_iso %>% 
  filter(OTU %in% ASV_in_all_samples) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  filter(location %in% "Changins") %>% 
  dplyr::select(OTU, family, Strain, '%') %>% 
  dplyr::rename(identity = '%')

all_phy_psmelt_iso_BX_identity_strains_wide <- all_phy_psmelt_iso_BX_identity_strains %>% 
  unique() %>% 
  pivot_wider(names_from = OTU, values_from = identity) %>% 
  as.data.frame() %>% 
  replace(.=="NULL", NA)
  


# write.table(all_phy_psmelt_iso_BX_identity_strains_wide %>% as.data.frame(), "all_phy_psmelt_iso_BX_identity_strains_wide.csv")
# *Bacillaceae*
## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% unique()
## # A tibble: 80 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [6]
##    phylum     genus    location background genotype OTU   family Strain identity
##    <chr>      <chr>    <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMX1      0.989
##  2 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMX8      0.989
##  3 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA21     0.984
##  4 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMM1      0.984
##  5 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMP1      0.984
##  6 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LME1      0.976
##  7 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LME2      0.976
##  8 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA21     0.974
##  9 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMJ1      0.971
## 10 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LMX1      0.989
## # ℹ 70 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 20 strains 
## # A tibble: 6 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [6]
##   OTU     phylum     family      genus    location background genotype     n
##   <chr>   <chr>      <chr>       <chr>    <fct>    <fct>      <fct>    <int>
## 1 ASV1182 Firmicutes Bacillaceae Bacillus Changins B73        WT           8
## 2 ASV1182 Firmicutes Bacillaceae Bacillus Changins B73        bx1          8
## 3 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        WT          20
## 4 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        bx1         20
## 5 ASV3604 Firmicutes Bacillaceae Bacillus Changins B73        WT          10
## 6 ASV3604 Firmicutes Bacillaceae Bacillus Changins B73        bx1         10
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% filter(identity %in% 1.0000000)
## # A tibble: 12 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum     genus    location background genotype OTU   family Strain identity
##    <chr>      <chr>    <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA21         1
##  2 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMM1          1
##  3 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMP1          1
##  4 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA21         1
##  5 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMM1          1
##  6 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LMP1          1
##  7 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA21         1
##  8 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LMM1          1
##  9 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LMP1          1
## 10 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA21         1
## 11 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LMM1          1
## 12 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LMP1          1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU     phylum     family      genus    location background genotype     n
##   <chr>   <chr>      <chr>       <chr>    <fct>    <fct>      <fct>    <int>
## 1 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        WT           3
## 2 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        bx1          3
# 3 strains mapping 100% to ASV1322

# other strains not mapping 100% 
Bacillaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Bacillaceae_100_id <- Bacillaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% filter(!Strain %in% Bacillaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 6 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [6]
##   OTU     phylum     family      genus    location background genotype     n
##   <chr>   <chr>      <chr>       <chr>    <fct>    <fct>      <fct>    <int>
## 1 ASV1182 Firmicutes Bacillaceae Bacillus Changins B73        WT           5
## 2 ASV1182 Firmicutes Bacillaceae Bacillus Changins B73        bx1          5
## 3 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        WT          17
## 4 ASV1322 Firmicutes Bacillaceae Bacillus Changins B73        bx1         17
## 5 ASV3604 Firmicutes Bacillaceae Bacillus Changins B73        WT           7
## 6 ASV3604 Firmicutes Bacillaceae Bacillus Changins B73        bx1          7
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Bacillaceae") %>% 
  filter(!Strain %in% Bacillaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 58 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [6]
##    phylum     genus    location background genotype OTU   family Strain identity
##    <chr>      <chr>    <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA1      0.976
##  2 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA1      0.976
##  3 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA112    0.976
##  4 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA112    0.976
##  5 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA20     0.979
##  6 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA20     0.979
##  7 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA3      0.976
##  8 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA3      0.976
##  9 Firmicutes Bacillus Changins B73        WT       ASV1… Bacil… LBA71     0.976
## 10 Firmicutes Bacillus Changins B73        bx1      ASV1… Bacil… LBA71     0.976
## # ℹ 48 more rows
#        OTU      family Strain  identity
# 1  ASV1322 Bacillaceae   LBA1 0.9762533
# 2  ASV1322 Bacillaceae LBA112 0.9762533
# 3  ASV1322 Bacillaceae  LBA20 0.9789474
# 4  ASV1322 Bacillaceae   LBA3 0.9762533
# 5  ASV1322 Bacillaceae  LBA71 0.9762533
# 6  ASV1322 Bacillaceae   LMA2 0.9788918
# 9  ASV1322 Bacillaceae   LME1 0.9868074
# 12 ASV1322 Bacillaceae   LME2 0.9868074
# 14 ASV1322 Bacillaceae   LMH1 0.9762533
# 15 ASV1182 Bacillaceae   LMJ1 0.9709763 !
# 16 ASV1322 Bacillaceae   LMJ1 0.9841689
# 17 ASV1322 Bacillaceae   LMO1 0.9788918
# 19 ASV1322 Bacillaceae   LMW1 0.9762533
# 20 ASV1182 Bacillaceae   LMX1 0.9894459 !
# 23 ASV1182 Bacillaceae   LMX8 0.9894459 !
# 26 ASV1322 Bacillaceae   LWS1 0.9709763
# 27 ASV1322 Bacillaceae  LWS11 0.9788918
# 29 ASV1322 Bacillaceae  LWS15 0.9709763

# Bacillaceae: ASV1322, except LMJ1, LMX1, LMX8 ASV1182


# *Microbacteriaceae*
## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% unique()
## # A tibble: 160 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI62         1
##  2 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI11         1
##  3 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI13         1
##  4 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI14         1
##  5 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI15         1
##  6 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI18         1
##  7 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI51         1
##  8 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMB2          1
##  9 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI1x         1
## 10 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI2x         1
## # ℹ 150 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 42 strains 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU     phylum         family         genus location background genotype     n
##   <chr>   <chr>          <chr>          <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        WT          42
## 2 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        bx1         42
## 3 ASV968  Actinobacteria Microbacteria… Micr… Changins B73        WT          32
## 4 ASV968  Actinobacteria Microbacteria… Micr… Changins B73        bx1         32
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% filter(identity %in% 1.0000000)
## # A tibble: 128 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI62         1
##  2 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI11         1
##  3 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI13         1
##  4 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI14         1
##  5 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI15         1
##  6 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI18         1
##  7 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI51         1
##  8 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMB2          1
##  9 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI1x         1
## 10 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI2x         1
## # ℹ 118 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU     phylum         family         genus location background genotype     n
##   <chr>   <chr>          <chr>          <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        WT          23
## 2 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        bx1         23
## 3 ASV968  Actinobacteria Microbacteria… Micr… Changins B73        WT           9
## 4 ASV968  Actinobacteria Microbacteria… Micr… Changins B73        bx1          9
# 32 strains mapping 100% to ASV1078

# other strains not mapping 100% 
micro_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
micro_100_id <- micro_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% filter(!Strain %in% micro_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU     phylum         family         genus location background genotype     n
##   <chr>   <chr>          <chr>          <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        WT          10
## 2 ASV1078 Actinobacteria Microbacteria… Micr… Changins B73        bx1         10
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Microbacteriaceae") %>% filter(!Strain %in% micro_100_id) %>% unique()
## # A tibble: 20 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI111    0.997
##  2 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI112    0.997
##  3 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI121    0.997
##  4 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI17     0.997
##  5 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI22     0.997
##  6 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI32     0.997
##  7 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI522    0.997
##  8 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI81     0.997
##  9 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LMI1      0.984
## 10 Actinobacter… Micr… Changins B73        WT       ASV1… Micro… LBO11     0.979
## 11 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI111    0.997
## 12 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI112    0.997
## 13 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI121    0.997
## 14 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI17     0.997
## 15 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI22     0.997
## 16 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI32     0.997
## 17 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI522    0.997
## 18 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI81     0.997
## 19 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LMI1      0.984
## 20 Actinobacter… Micr… Changins B73        bx1      ASV1… Micro… LBO11     0.979
# 10 strains mapping to ASV1078 (0.9973615, 0.9841689, 0.9788918)

# Microbacteriaceae: ASV1078

# *Micrococcaceae*
## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% unique()
## # A tibble: 24 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA2      0.997
##  2 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA21     0.997
##  3 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LAR21     0.995
##  4 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA2      0.995
##  5 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA21     0.995
##  6 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LWH5      0.987
##  7 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMD1      0.982
##  8 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMD2      0.982
##  9 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LBS1      0.982
## 10 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMX5      0.979
## # ℹ 14 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 9 strains 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU    phylum         family         genus  location background genotype     n
##   <chr>  <chr>          <chr>          <chr>  <fct>    <fct>      <fct>    <int>
## 1 ASV105 Actinobacteria Micrococcaceae Pseud… Changins B73        WT           8
## 2 ASV105 Actinobacteria Micrococcaceae Pseud… Changins B73        bx1          8
## 3 ASV972 Actinobacteria Micrococcaceae Arthr… Changins B73        WT           1
## 4 ASV972 Actinobacteria Micrococcaceae Arthr… Changins B73        bx1          1
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% filter(identity %in% 1.0000000)
## # A tibble: 4 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   phylum         genus location background genotype OTU   family Strain identity
##   <chr>          <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
## 1 Actinobacteria Arth… Changins B73        WT       ASV9… Micro… LAR12         1
## 2 Actinobacteria Arth… Changins B73        WT       ASV9… Micro… LAR12         1
## 3 Actinobacteria Arth… Changins B73        bx1      ASV9… Micro… LAR12         1
## 4 Actinobacteria Arth… Changins B73        bx1      ASV9… Micro… LAR12         1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU    phylum         family         genus  location background genotype     n
##   <chr>  <chr>          <chr>          <chr>  <fct>    <fct>      <fct>    <int>
## 1 ASV972 Actinobacteria Micrococcaceae Arthr… Changins B73        WT           1
## 2 ASV972 Actinobacteria Micrococcaceae Arthr… Changins B73        bx1          1
# 1 strains mapping 100% to ASV972 (LAR12)

# other strains not mapping 100% 
Micrococcaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Micrococcaceae_100_id <- Micrococcaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% filter(!Strain %in% Micrococcaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU    phylum         family         genus  location background genotype     n
##   <chr>  <chr>          <chr>          <chr>  <fct>    <fct>      <fct>    <int>
## 1 ASV105 Actinobacteria Micrococcaceae Pseud… Changins B73        WT           8
## 2 ASV105 Actinobacteria Micrococcaceae Pseud… Changins B73        bx1          8
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Micrococcaceae") %>% 
  filter(!Strain %in% Micrococcaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 20 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LAR21     0.995
##  2 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LAR21     0.995
##  3 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LBS1      0.982
##  4 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LBS1      0.982
##  5 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMD1      0.982
##  6 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LMD1      0.982
##  7 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMD2      0.982
##  8 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LMD2      0.982
##  9 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LMX5      0.979
## 10 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LMX5      0.979
## 11 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA2      0.997
## 12 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA2      0.995
## 13 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LPA2      0.997
## 14 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LPA2      0.995
## 15 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA21     0.997
## 16 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LPA21     0.995
## 17 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LPA21     0.997
## 18 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LPA21     0.995
## 19 Actinobacter… Pseu… Changins B73        WT       ASV1… Micro… LWH5      0.987
## 20 Actinobacter… Pseu… Changins B73        bx1      ASV1… Micro… LWH5      0.987
# 9 strains mapping to ASV105

# *Oxalobacteraceae*
all_phy_psmelt_iso_BX_identity_strains$family <- gsub("Burkholderiaceae", "Oxalobacteraceae", all_phy_psmelt_iso_BX_identity_strains$family)

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% unique()
## # A tibble: 24 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [14]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Jant… Changins B73        WT       ASV1… Oxalo… LMS1      0.995
##  2 Proteobacter… Jant… Changins B73        WT       ASV1… Oxalo… LMU1      0.981
##  3 Proteobacter… Jant… Changins B73        bx1      ASV1… Oxalo… LMS1      0.995
##  4 Proteobacter… Jant… Changins B73        bx1      ASV1… Oxalo… LMU1      0.981
##  5 Proteobacter… Pseu… Changins B73        WT       ASV2… Oxalo… LMS1      0.970
##  6 Proteobacter… Pseu… Changins B73        bx1      ASV2… Oxalo… LMS1      0.970
##  7 Proteobacter… Duga… Changins B73        WT       ASV2… Oxalo… LMU1      0.995
##  8 Proteobacter… Duga… Changins B73        WT       ASV2… Oxalo… LMS1      0.976
##  9 Proteobacter… Duga… Changins B73        bx1      ASV2… Oxalo… LMU1      0.995
## 10 Proteobacter… Duga… Changins B73        bx1      ASV2… Oxalo… LMS1      0.976
## # ℹ 14 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 2 strains 
## # A tibble: 14 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [14]
##    OTU    phylum         family         genus location background genotype     n
##    <chr>  <chr>          <chr>          <chr> <fct>    <fct>      <fct>    <int>
##  1 ASV107 Proteobacteria Oxalobacterac… Jant… Changins B73        WT           2
##  2 ASV107 Proteobacteria Oxalobacterac… Jant… Changins B73        bx1          2
##  3 ASV247 Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           1
##  4 ASV247 Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          1
##  5 ASV267 Proteobacteria Oxalobacterac… Duga… Changins B73        WT           2
##  6 ASV267 Proteobacteria Oxalobacterac… Duga… Changins B73        bx1          2
##  7 ASV356 Proteobacteria Oxalobacterac… <NA>  Changins B73        WT           2
##  8 ASV356 Proteobacteria Oxalobacterac… <NA>  Changins B73        bx1          2
##  9 ASV452 Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           2
## 10 ASV452 Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          2
## 11 ASV54  Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           1
## 12 ASV54  Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          1
## 13 ASV917 Proteobacteria Oxalobacterac… Duga… Changins B73        WT           2
## 14 ASV917 Proteobacteria Oxalobacterac… Duga… Changins B73        bx1          2
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% filter(identity %in% 1.0000000)
## # A tibble: 0 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [0]
## # ℹ 9 variables: phylum <chr>, genus <chr>, location <fct>, background <fct>,
## #   genotype <fct>, OTU <chr>, family <chr>, Strain <chr>, identity <dbl>
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 0 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [0]
## # ℹ 8 variables: OTU <chr>, phylum <chr>, family <chr>, genus <chr>,
## #   location <fct>, background <fct>, genotype <fct>, n <int>
# 0 strains mapping 100% 

# other strains not mapping 100% 
Oxalobacteraceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Oxalobacteraceae_100_id <- Oxalobacteraceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% filter(!Strain %in% Oxalobacteraceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 14 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [14]
##    OTU    phylum         family         genus location background genotype     n
##    <chr>  <chr>          <chr>          <chr> <fct>    <fct>      <fct>    <int>
##  1 ASV107 Proteobacteria Oxalobacterac… Jant… Changins B73        WT           2
##  2 ASV107 Proteobacteria Oxalobacterac… Jant… Changins B73        bx1          2
##  3 ASV247 Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           1
##  4 ASV247 Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          1
##  5 ASV267 Proteobacteria Oxalobacterac… Duga… Changins B73        WT           2
##  6 ASV267 Proteobacteria Oxalobacterac… Duga… Changins B73        bx1          2
##  7 ASV356 Proteobacteria Oxalobacterac… <NA>  Changins B73        WT           2
##  8 ASV356 Proteobacteria Oxalobacterac… <NA>  Changins B73        bx1          2
##  9 ASV452 Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           2
## 10 ASV452 Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          2
## 11 ASV54  Proteobacteria Oxalobacterac… Pseu… Changins B73        WT           1
## 12 ASV54  Proteobacteria Oxalobacterac… Pseu… Changins B73        bx1          1
## 13 ASV917 Proteobacteria Oxalobacterac… Duga… Changins B73        WT           2
## 14 ASV917 Proteobacteria Oxalobacterac… Duga… Changins B73        bx1          2
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Oxalobacteraceae") %>% 
  filter(!Strain %in% Oxalobacteraceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 24 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [14]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Jant… Changins B73        WT       ASV1… Oxalo… LMS1      0.995
##  2 Proteobacter… Jant… Changins B73        bx1      ASV1… Oxalo… LMS1      0.995
##  3 Proteobacter… Pseu… Changins B73        WT       ASV2… Oxalo… LMS1      0.970
##  4 Proteobacter… Pseu… Changins B73        bx1      ASV2… Oxalo… LMS1      0.970
##  5 Proteobacter… Duga… Changins B73        WT       ASV2… Oxalo… LMS1      0.976
##  6 Proteobacter… Duga… Changins B73        bx1      ASV2… Oxalo… LMS1      0.976
##  7 Proteobacter… <NA>  Changins B73        WT       ASV3… Oxalo… LMS1      0.981
##  8 Proteobacter… <NA>  Changins B73        bx1      ASV3… Oxalo… LMS1      0.981
##  9 Proteobacter… Pseu… Changins B73        WT       ASV4… Oxalo… LMS1      0.970
## 10 Proteobacter… Pseu… Changins B73        bx1      ASV4… Oxalo… LMS1      0.970
## # ℹ 14 more rows
# ASV267 Oxalobacteraceae   LMU1 0.9946237
# ASV107 Oxalobacteraceae   LMS1 0.9946237

# *Pseudomonadaceae*

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% unique()
## # A tibble: 46 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMY1      0.997
##  2 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LPD11     0.992
##  3 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LPD12     0.992
##  4 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMX11     0.992
##  5 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMX4      0.992
##  6 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMX9      0.992
##  7 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LWO6      0.992
##  8 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LWO15     0.992
##  9 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LPD12     0.981
## 10 Proteobacter… Pseu… Changins B73        bx1      ASV3… Pseud… LMY1      0.997
## # ℹ 36 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 2 strains 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU    phylum         family          genus location background genotype     n
##   <chr>  <chr>          <chr>           <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV340 Proteobacteria Pseudomonadace… Pseu… Changins B73        WT           8
## 2 ASV340 Proteobacteria Pseudomonadace… Pseu… Changins B73        bx1          8
## 3 ASV4   Proteobacteria Pseudomonadace… Pseu… Changins B73        WT          13
## 4 ASV4   Proteobacteria Pseudomonadace… Pseu… Changins B73        bx1         13
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% filter(identity %in% 1.0000000) %>% unique()
## # A tibble: 10 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LPD11         1
##  2 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LPD12         1
##  3 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LMX4          1
##  4 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LMX9          1
##  5 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LWO15         1
##  6 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LPD11         1
##  7 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LPD12         1
##  8 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LMX4          1
##  9 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LMX9          1
## 10 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LWO15         1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family           genus location background genotype     n
##   <chr> <chr>          <chr>            <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV4  Proteobacteria Pseudomonadaceae Pseu… Changins B73        WT           5
## 2 ASV4  Proteobacteria Pseudomonadaceae Pseu… Changins B73        bx1          5
# 5 strains mapping 100% to ASV4

# other strains not mapping 100% 
Pseudomonadaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Pseudomonadaceae_100_id <- Pseudomonadaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% filter(!Strain %in% Pseudomonadaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU    phylum         family          genus location background genotype     n
##   <chr>  <chr>          <chr>           <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV340 Proteobacteria Pseudomonadace… Pseu… Changins B73        WT           3
## 2 ASV340 Proteobacteria Pseudomonadace… Pseu… Changins B73        bx1          3
## 3 ASV4   Proteobacteria Pseudomonadace… Pseu… Changins B73        WT           8
## 4 ASV4   Proteobacteria Pseudomonadace… Pseu… Changins B73        bx1          8
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Pseudomonadaceae") %>% 
  filter(!Strain %in% Pseudomonadaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 22 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMX11     0.992
##  2 Proteobacter… Pseu… Changins B73        bx1      ASV3… Pseud… LMX11     0.992
##  3 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LMX11     0.997
##  4 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LMX11     0.997
##  5 Proteobacter… Pseu… Changins B73        WT       ASV3… Pseud… LMY1      0.997
##  6 Proteobacter… Pseu… Changins B73        bx1      ASV3… Pseud… LMY1      0.997
##  7 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LMY1      0.992
##  8 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LMY1      0.992
##  9 Proteobacter… Pseu… Changins B73        WT       ASV4  Pseud… LPB4.O    0.974
## 10 Proteobacter… Pseu… Changins B73        bx1      ASV4  Pseud… LPB4.O    0.974
## # ℹ 12 more rows
# 7 strains mapping to ASV4, one strain mapping to ASV340

# *Rhizobiaceae*

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% unique()
## # A tibble: 14 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Neor… Changins B73        WT       ASV1… Rhizo… LMQ1      0.992
##  2 Proteobacter… Neor… Changins B73        bx1      ASV1… Rhizo… LMQ1      0.992
##  3 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH12     1    
##  4 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH13     1    
##  5 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH11     1    
##  6 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRC7.O    1    
##  7 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRC7.S    1    
##  8 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH11     0.997
##  9 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH12     1    
## 10 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH13     1    
## 11 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH11     1    
## 12 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRC7.O    1    
## 13 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRC7.S    1    
## 14 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH11     0.997
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 6 strains 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU     phylum         family       genus   location background genotype     n
##   <chr>   <chr>          <chr>        <chr>   <fct>    <fct>      <fct>    <int>
## 1 ASV1000 Proteobacteria Rhizobiaceae Neorhi… Changins B73        WT           1
## 2 ASV1000 Proteobacteria Rhizobiaceae Neorhi… Changins B73        bx1          1
## 3 ASV8    Proteobacteria Rhizobiaceae Allorh… Changins B73        WT           5
## 4 ASV8    Proteobacteria Rhizobiaceae Allorh… Changins B73        bx1          5
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% filter(identity %in% 1.0000000) %>% unique()
## # A tibble: 10 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH12         1
##  2 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH13         1
##  3 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRH11         1
##  4 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRC7.O        1
##  5 Proteobacter… Allo… Changins B73        WT       ASV8  Rhizo… LRC7.S        1
##  6 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH12         1
##  7 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH13         1
##  8 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRH11         1
##  9 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRC7.O        1
## 10 Proteobacter… Allo… Changins B73        bx1      ASV8  Rhizo… LRC7.S        1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family       genus     location background genotype     n
##   <chr> <chr>          <chr>        <chr>     <fct>    <fct>      <fct>    <int>
## 1 ASV8  Proteobacteria Rhizobiaceae Allorhiz… Changins B73        WT           5
## 2 ASV8  Proteobacteria Rhizobiaceae Allorhiz… Changins B73        bx1          5
# 5 strains mapping 100% to ASV8

# other strains not mapping 100% 
Rhizobiaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Rhizobiaceae_100_id <- Rhizobiaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% filter(!Strain %in% Rhizobiaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU     phylum         family       genus   location background genotype     n
##   <chr>   <chr>          <chr>        <chr>   <fct>    <fct>      <fct>    <int>
## 1 ASV1000 Proteobacteria Rhizobiaceae Neorhi… Changins B73        WT           1
## 2 ASV1000 Proteobacteria Rhizobiaceae Neorhi… Changins B73        bx1          1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Rhizobiaceae") %>% 
  filter(!Strain %in% Rhizobiaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 2 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   phylum         genus location background genotype OTU   family Strain identity
##   <chr>          <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
## 1 Proteobacteria Neor… Changins B73        WT       ASV1… Rhizo… LMQ1      0.992
## 2 Proteobacteria Neor… Changins B73        bx1      ASV1… Rhizo… LMQ1      0.992
# 1 strains mapping to ASV4, one strain mapping to ASV1000

# *Sphingomonadaceae*

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% unique()
## # A tibble: 28 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LSP13         1
##  2 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LMA1          1
##  3 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LMC3          1
##  4 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH2          1
##  5 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH3          1
##  6 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH7          1
##  7 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO4          1
##  8 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO6          1
##  9 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LWH4          1
## 10 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LWH8          1
## # ℹ 18 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 13 strains 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU    phylum         family          genus location background genotype     n
##   <chr>  <chr>          <chr>           <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV3   Proteobacteria Sphingomonadac… Sphi… Changins B73        WT          13
## 2 ASV3   Proteobacteria Sphingomonadac… Sphi… Changins B73        bx1         13
## 3 ASV784 Proteobacteria Sphingomonadac… Sphi… Changins B73        WT           1
## 4 ASV784 Proteobacteria Sphingomonadac… Sphi… Changins B73        bx1          1
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% filter(identity %in% 1.0000000) %>% unique()
## # A tibble: 24 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LSP13         1
##  2 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LMA1          1
##  3 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LMC3          1
##  4 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH2          1
##  5 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH3          1
##  6 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH7          1
##  7 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO4          1
##  8 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO6          1
##  9 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LWH4          1
## 10 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LWH8          1
## # ℹ 14 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family           genus location background genotype     n
##   <chr> <chr>          <chr>            <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV3  Proteobacteria Sphingomonadace… Sphi… Changins B73        WT          12
## 2 ASV3  Proteobacteria Sphingomonadace… Sphi… Changins B73        bx1         12
# 12 strains mapping 100% to ASV3

# other strains not mapping 100% 
Sphingomonadaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Sphingomonadaceae_100_id <- Sphingomonadaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% filter(!Strain %in% Sphingomonadaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 4 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##   OTU    phylum         family          genus location background genotype     n
##   <chr>  <chr>          <chr>           <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV3   Proteobacteria Sphingomonadac… Sphi… Changins B73        WT           1
## 2 ASV3   Proteobacteria Sphingomonadac… Sphi… Changins B73        bx1          1
## 3 ASV784 Proteobacteria Sphingomonadac… Sphi… Changins B73        WT           1
## 4 ASV784 Proteobacteria Sphingomonadac… Sphi… Changins B73        bx1          1
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Sphingomonadaceae") %>% 
  filter(!Strain %in% Rhizobiaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 28 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [4]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH2          1
##  2 Proteobacter… Sphi… Changins B73        bx1      ASV3  Sphin… LBH2          1
##  3 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH3          1
##  4 Proteobacter… Sphi… Changins B73        bx1      ASV3  Sphin… LBH3          1
##  5 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBH7          1
##  6 Proteobacter… Sphi… Changins B73        bx1      ASV3  Sphin… LBH7          1
##  7 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO4          1
##  8 Proteobacter… Sphi… Changins B73        bx1      ASV3  Sphin… LBO4          1
##  9 Proteobacter… Sphi… Changins B73        WT       ASV3  Sphin… LBO6          1
## 10 Proteobacter… Sphi… Changins B73        bx1      ASV3  Sphin… LBO6          1
## # ℹ 18 more rows
# 1 strains mapping to ASV3

# *Streptomycetaceae*

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% unique()
## # A tibble: 40 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [18]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMG1      0.984
##  2 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMG2      0.984
##  3 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMF1      0.971
##  4 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMG1      0.984
##  5 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMG2      0.984
##  6 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMF1      0.971
##  7 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMG1      0.979
##  8 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMG2      0.979
##  9 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMF1      0.977
## 10 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMG1      0.979
## # ℹ 30 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 3 strains 
## # A tibble: 18 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [18]
##    OTU     phylum         family        genus location background genotype     n
##    <chr>   <chr>          <chr>         <chr> <fct>    <fct>      <fct>    <int>
##  1 ASV100  Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  2 ASV100  Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  3 ASV1317 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  4 ASV1317 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  5 ASV1521 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  6 ASV1521 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  7 ASV2397 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  8 ASV2397 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  9 ASV265  Actinobacteria Streptomycet… Stre… Changins B73        WT           1
## 10 ASV265  Actinobacteria Streptomycet… Stre… Changins B73        bx1          1
## 11 ASV382  Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 12 ASV382  Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
## 13 ASV49   Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 14 ASV49   Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
## 15 ASV538  Actinobacteria Streptomycet… Stre… Changins B73        WT           1
## 16 ASV538  Actinobacteria Streptomycet… Stre… Changins B73        bx1          1
## 17 ASV64   Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 18 ASV64   Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% filter(identity %in% 1.0000000) %>% unique()
## # A tibble: 0 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [0]
## # ℹ 9 variables: phylum <chr>, genus <chr>, location <fct>, background <fct>,
## #   genotype <fct>, OTU <chr>, family <chr>, Strain <chr>, identity <dbl>
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 0 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [0]
## # ℹ 8 variables: OTU <chr>, phylum <chr>, family <chr>, genus <chr>,
## #   location <fct>, background <fct>, genotype <fct>, n <int>
# 0 strains mapping 100% 

# other strains not mapping 100% 
Streptomycetaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Streptomycetaceae_100_id <- Streptomycetaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% filter(!Strain %in% Streptomycetaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 18 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [18]
##    OTU     phylum         family        genus location background genotype     n
##    <chr>   <chr>          <chr>         <chr> <fct>    <fct>      <fct>    <int>
##  1 ASV100  Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  2 ASV100  Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  3 ASV1317 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  4 ASV1317 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  5 ASV1521 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  6 ASV1521 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  7 ASV2397 Actinobacteria Streptomycet… Stre… Changins B73        WT           3
##  8 ASV2397 Actinobacteria Streptomycet… Stre… Changins B73        bx1          3
##  9 ASV265  Actinobacteria Streptomycet… Stre… Changins B73        WT           1
## 10 ASV265  Actinobacteria Streptomycet… Stre… Changins B73        bx1          1
## 11 ASV382  Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 12 ASV382  Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
## 13 ASV49   Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 14 ASV49   Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
## 15 ASV538  Actinobacteria Streptomycet… Stre… Changins B73        WT           1
## 16 ASV538  Actinobacteria Streptomycet… Stre… Changins B73        bx1          1
## 17 ASV64   Actinobacteria Streptomycet… Stre… Changins B73        WT           2
## 18 ASV64   Actinobacteria Streptomycet… Stre… Changins B73        bx1          2
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Streptomycetaceae") %>% 
  filter(!Strain %in% Streptomycetaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 40 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [18]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMF1      0.971
##  2 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMF1      0.971
##  3 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMF1      0.977
##  4 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMF1      0.977
##  5 Actinobacter… Stre… Changins B73        WT       ASV1… Strep… LMF1      0.971
##  6 Actinobacter… Stre… Changins B73        bx1      ASV1… Strep… LMF1      0.971
##  7 Actinobacter… Stre… Changins B73        WT       ASV2… Strep… LMF1      0.974
##  8 Actinobacter… Stre… Changins B73        bx1      ASV2… Strep… LMF1      0.974
##  9 Actinobacter… Stre… Changins B73        WT       ASV49 Strep… LMF1      0.971
## 10 Actinobacter… Stre… Changins B73        bx1      ASV49 Strep… LMF1      0.971
## # ℹ 30 more rows
#        OTU            family Strain  identity
# 5   ASV538 Streptomycetaceae   LMF1 0.9844156
# 12 ASV1521 Streptomycetaceae   LMG1 0.9844156
# 20 ASV1521 Streptomycetaceae   LMG2 0.9844156

# 1 strains mapping to ASV538, one strain mapping to ASV1521

# *Xanthomonadaceae*

## total strains
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% unique()
## # A tibble: 68 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST23         1
##  2 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST12         1
##  3 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST15         1
##  4 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST11         1
##  5 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST13         1
##  6 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST14         1
##  7 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST16         1
##  8 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST17         1
##  9 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST19         1
## 10 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST20         1
## # ℹ 58 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% dplyr::select(Strain) %>% unique() %>% count() # 23 strains 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family           genus location background genotype     n
##   <chr> <chr>          <chr>            <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        WT          23
## 2 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        bx1         23
## strains mapping 100%
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% filter(identity %in% 1.0000000) %>% unique()
## # A tibble: 28 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST23         1
##  2 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST12         1
##  3 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST15         1
##  4 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST11         1
##  5 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST13         1
##  6 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST14         1
##  7 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST16         1
##  8 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST17         1
##  9 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST19         1
## 10 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST20         1
## # ℹ 18 more rows
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family           genus location background genotype     n
##   <chr> <chr>          <chr>            <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        WT          14
## 2 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        bx1         14
# 14 strains mapping 100% to ASV8

# other strains not mapping 100% 
Xanthomonadaceae_100_id <- all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% filter(identity %in% 1.0000000) %>% dplyr::select(Strain)
Xanthomonadaceae_100_id <- Xanthomonadaceae_100_id$Strain 
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% filter(!Strain %in% Xanthomonadaceae_100_id) %>% unique() %>% dplyr::select(Strain) %>% unique() %>% count() 
## # A tibble: 2 × 8
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##   OTU   phylum         family           genus location background genotype     n
##   <chr> <chr>          <chr>            <chr> <fct>    <fct>      <fct>    <int>
## 1 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        WT           9
## 2 ASV12 Proteobacteria Xanthomonadaceae Sten… Changins B73        bx1          9
all_phy_psmelt_iso_BX_identity_strains %>% filter(family %in% "Xanthomonadaceae") %>% 
  filter(!Strain %in% Xanthomonadaceae_100_id) %>% 
  unique() %>% 
  dplyr::arrange(Strain)
## # A tibble: 18 × 9
## # Groups:   OTU, phylum, family, genus, location, background, genotype [2]
##    phylum        genus location background genotype OTU   family Strain identity
##    <chr>         <chr> <fct>    <fct>      <fct>    <chr> <chr>  <chr>     <dbl>
##  1 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST18     0.987
##  2 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST18     0.987
##  3 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST21     0.989
##  4 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST21     0.989
##  5 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST22     0.997
##  6 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST22     0.997
##  7 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST28     0.989
##  8 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST28     0.989
##  9 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST52     0.989
## 10 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST52     0.989
## 11 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST521    0.989
## 12 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST521    0.989
## 13 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST61     0.989
## 14 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST61     0.989
## 15 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST72     0.989
## 16 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST72     0.989
## 17 Proteobacter… Sten… Changins B73        WT       ASV12 Xanth… LST82     0.989
## 18 Proteobacter… Sten… Changins B73        bx1      ASV12 Xanth… LST82     0.989
# Other families
iso.tab_id <- iso.tab %>% dplyr::rename(identity = '%')
iso.tab_id %>% filter(Strain %in% "LMN1") %>% filter(identity %in% 1.0000000) %>% unique()
##   identity Strain      ASV
## 1        1   LMN1  ASV2934
## 2        1   LMN1  ASV8576
## 3        1   LMN1 ASV11112
#           % Strain      ASV
# 1 1.0000000   LMN1  ASV2934
# 3 1.0000000   LMN1  ASV8576
# 5 1.0000000   LMN1 ASV11112

iso.tab_id %>% filter(Strain %in% "LMN1") %>% unique()
##    identity Strain      ASV
## 1 1.0000000   LMN1  ASV2934
## 2 0.9927361   LMN1  ASV5661
## 3 1.0000000   LMN1  ASV8576
## 4 0.9927361   LMN1  ASV9108
## 5 1.0000000   LMN1 ASV11112
#    identity Strain      ASV
# 1 1.0000000   LMN1  ASV2934
# 2 0.9927361   LMN1  ASV5661
# 3 1.0000000   LMN1  ASV8576
# 4 0.9927361   LMN1  ASV9108
# 5 1.0000000   LMN1 ASV11112

iso.tab_id %>% filter(Strain %in% c("LME3", "LMX9231", "LMZ1")) %>% filter(identity %in% 1.0000000) %>% unique() %>% 
  dplyr::arrange(Strain)
##   identity  Strain   ASV
## 1        1    LME3 ASV31
## 2        1 LMX9231 ASV31
## 3        1    LMZ1 ASV31
#   identity  Strain   ASV
# 1        1    LME3 ASV31
# 2        1 LMX9231 ASV31
# 3        1    LMZ1 ASV31

iso.tab_id %>% filter(Strain %in% c("LME3", "LMX9231", "LMZ1")) %>% unique() %>% 
  dplyr::arrange(Strain)
##      identity  Strain      ASV
## 1   1.0000000    LME3    ASV31
## 2   0.9708223    LME3    ASV85
## 3   0.9893899    LME3    ASV93
## 4   0.9814324    LME3   ASV190
## 5   0.9708223    LME3   ASV461
## 6   0.9867374    LME3   ASV508
## 7   0.9946950    LME3   ASV518
## 8   0.9734748    LME3   ASV680
## 9   0.9973475    LME3   ASV988
## 10  0.9840849    LME3  ASV1034
## 11  0.9787798    LME3  ASV1570
## 12  0.9761273    LME3  ASV2286
## 13  0.9867374    LME3  ASV2415
## 14  0.9840849    LME3  ASV2875
## 15  0.9920424    LME3  ASV3081
## 16  0.9761905    LME3  ASV3214
## 17  0.9761273    LME3  ASV3241
## 18  0.9787798    LME3  ASV3258
## 19  0.9761273    LME3  ASV3270
## 20  0.9814324    LME3  ASV3331
## 21  0.9973475    LME3  ASV3491
## 22  0.9920424    LME3  ASV3745
## 23  0.9788360    LME3  ASV4046
## 24  0.9782609    LME3  ASV4579
## 25  0.9782609    LME3  ASV4763
## 26  0.9787798    LME3  ASV5123
## 27  0.9734748    LME3  ASV6307
## 28  0.9814815    LME3  ASV6451
## 29  0.9787798    LME3  ASV6550
## 30  0.9708223    LME3  ASV7411
## 31  0.9893899    LME3  ASV7445
## 32  0.9893899    LME3  ASV7523
## 33  0.9867374    LME3  ASV7530
## 34  0.9841270    LME3  ASV7754
## 35  0.9840849    LME3  ASV8519
## 36  0.9787798    LME3  ASV8832
## 37  0.9867374    LME3  ASV8954
## 38  0.9840849    LME3 ASV10456
## 39  0.9973475    LME3 ASV10722
## 40  0.9734748    LME3 ASV11380
## 41  0.9758454    LME3 ASV12901
## 42  0.9973475    LME3 ASV14980
## 43  0.9758454    LME3 ASV15171
## 44  0.9735450    LME3 ASV15334
## 45  0.9806763    LME3 ASV15530
## 46  0.9787798    LME3 ASV16109
## 47  0.9867374    LME3 ASV16491
## 48  0.9758454    LME3 ASV17105
## 49  1.0000000 LMX9231    ASV31
## 50  0.9708223 LMX9231    ASV85
## 51  0.9893899 LMX9231    ASV93
## 52  0.9814324 LMX9231   ASV190
## 53  0.9708223 LMX9231   ASV461
## 54  0.9867374 LMX9231   ASV508
## 55  0.9946950 LMX9231   ASV518
## 56  0.9734748 LMX9231   ASV680
## 57  0.9973475 LMX9231   ASV988
## 58  0.9840849 LMX9231  ASV1034
## 59  0.9787798 LMX9231  ASV1570
## 60  0.9761273 LMX9231  ASV2286
## 61  0.9867374 LMX9231  ASV2415
## 62  0.9840849 LMX9231  ASV2875
## 63  0.9920424 LMX9231  ASV3081
## 64  0.9761905 LMX9231  ASV3214
## 65  0.9761273 LMX9231  ASV3241
## 66  0.9787798 LMX9231  ASV3258
## 67  0.9761273 LMX9231  ASV3270
## 68  0.9814324 LMX9231  ASV3331
## 69  0.9973475 LMX9231  ASV3491
## 70  0.9920424 LMX9231  ASV3745
## 71  0.9788360 LMX9231  ASV4046
## 72  0.9782609 LMX9231  ASV4579
## 73  0.9782609 LMX9231  ASV4763
## 74  0.9787798 LMX9231  ASV5123
## 75  0.9734748 LMX9231  ASV6307
## 76  0.9814815 LMX9231  ASV6451
## 77  0.9787798 LMX9231  ASV6550
## 78  0.9708223 LMX9231  ASV7411
## 79  0.9893899 LMX9231  ASV7445
## 80  0.9893899 LMX9231  ASV7523
## 81  0.9867374 LMX9231  ASV7530
## 82  0.9841270 LMX9231  ASV7754
## 83  0.9840849 LMX9231  ASV8519
## 84  0.9787798 LMX9231  ASV8832
## 85  0.9867374 LMX9231  ASV8954
## 86  0.9840849 LMX9231 ASV10456
## 87  0.9973475 LMX9231 ASV10722
## 88  0.9734748 LMX9231 ASV11380
## 89  0.9758454 LMX9231 ASV12901
## 90  0.9973475 LMX9231 ASV14980
## 91  0.9758454 LMX9231 ASV15171
## 92  0.9735450 LMX9231 ASV15334
## 93  0.9806763 LMX9231 ASV15530
## 94  0.9787798 LMX9231 ASV16109
## 95  0.9867374 LMX9231 ASV16491
## 96  0.9758454 LMX9231 ASV17105
## 97  1.0000000    LMZ1    ASV31
## 98  0.9761273    LMZ1    ASV85
## 99  0.9946950    LMZ1    ASV93
## 100 0.9867374    LMZ1   ASV190
## 101 0.9761273    LMZ1   ASV461
## 102 0.9920424    LMZ1   ASV508
## 103 0.9946950    LMZ1   ASV518
## 104 0.9787798    LMZ1   ASV680
## 105 0.9973475    LMZ1   ASV988
## 106 0.9893899    LMZ1  ASV1034
## 107 0.9734748    LMZ1  ASV1110
## 108 0.9787798    LMZ1  ASV1570
## 109 0.9734748    LMZ1  ASV2156
## 110 0.9814324    LMZ1  ASV2286
## 111 0.9708223    LMZ1  ASV2339
## 112 0.9867374    LMZ1  ASV2415
## 113 0.9893899    LMZ1  ASV2875
## 114 0.9734748    LMZ1  ASV2941
## 115 0.9920424    LMZ1  ASV3081
## 116 0.9761905    LMZ1  ASV3214
## 117 0.9761273    LMZ1  ASV3241
## 118 0.9840849    LMZ1  ASV3258
## 119 0.9814324    LMZ1  ASV3270
## 120 0.9867374    LMZ1  ASV3331
## 121 0.9973475    LMZ1  ASV3491
## 122 0.9920424    LMZ1  ASV3745
## 123 0.9788360    LMZ1  ASV4046
## 124 0.9782609    LMZ1  ASV4579
## 125 0.9782609    LMZ1  ASV4763
## 126 0.9814324    LMZ1  ASV5123
## 127 0.9761273    LMZ1  ASV6307
## 128 0.9814815    LMZ1  ASV6451
## 129 0.9840849    LMZ1  ASV6550
## 130 0.9761273    LMZ1  ASV7411
## 131 0.9893899    LMZ1  ASV7445
## 132 0.9893899    LMZ1  ASV7523
## 133 0.9920424    LMZ1  ASV7530
## 134 0.9841270    LMZ1  ASV7754
## 135 0.9840849    LMZ1  ASV8519
## 136 0.9840849    LMZ1  ASV8832
## 137 0.9867374    LMZ1  ASV8954
## 138 0.9708995    LMZ1 ASV10221
## 139 0.9893899    LMZ1 ASV10456
## 140 0.9973475    LMZ1 ASV10722
## 141 0.9761273    LMZ1 ASV11380
## 142 0.9758454    LMZ1 ASV12901
## 143 0.9973475    LMZ1 ASV14980
## 144 0.9806763    LMZ1 ASV15171
## 145 0.9735450    LMZ1 ASV15334
## 146 0.9855072    LMZ1 ASV15530
## 147 0.9787798    LMZ1 ASV16109
## 148 0.9920424    LMZ1 ASV16491
## 149 0.9758454    LMZ1 ASV17105
## 150 0.9710145    LMZ1 ASV20663
## 151 0.9710145    LMZ1 ASV24304
iso.tab_id %>% filter(Strain %in% c("LMC1", "LMK1")) %>% filter(identity %in% 1.0000000) %>% unique() %>% 
  dplyr::arrange(Strain)
##   identity Strain    ASV
## 1        1   LMC1 ASV377
## 2        1   LMK1 ASV377
#   identity Strain    ASV
# 1        1   LMC1 ASV377
# 2        1   LMK1 ASV377
#ASV474

iso.tab_id %>% filter(Strain %in% c("LAC11")) %>% filter(identity %in% 1.0000000) %>% unique()
##   identity Strain      ASV
## 1        1  LAC11 ASV20338
#   identity Strain      ASV
# 1        1  LAC11 ASV20338

iso.tab_id %>% filter(Strain %in% c("LML1")) %>% filter(identity %in% 1.0000000) %>% unique() %>% 
  dplyr::arrange(Strain)
## [1] identity Strain   ASV     
## <0 rows> (or 0-length row.names)
#    identity Strain      ASV
# 1 0.9973545   LML1  ASV2632

selected_ASVs <- c("ASV2934", "ASV31", "ASV474", "ASV20338", "ASV2632", "ASV1078", "ASV1322", "ASV1182", "ASV105", "ASV972", "ASV267", "ASV107", "ASV4", "ASV340", "ASV8", "ASV1000", "ASV3", "ASV538", "ASV1521", "ASV12")

Selection: highest similarity ASV1078 Microbacteriaceae ASV1322 Bacillaceae ASV1182 Bacillaceae (LMJ1, LMX1, LMX8) ASV105 Micrococcaceae ASV972 Micrococcaceae (LAR12) ASV267 Oxalobacteraceae LMU1 ASV107 Oxalobacteraceae LMS1 ASV4 Pseudomonadaceae ASV340 Pseudomonadaceae LMY1 ASV8 Rhizobiaceae ASV1000 Rhizobiaceae (LMQ1) ASV3 Sphingomonadaceae ASV538 Streptomycetaceae (LMF1) ASV1521 Streptomycetaceae (LMG1, LMG2) ASV12 Xanthomonadaceae ASV2632 LML1
ASV20338 LAC11 ASV474 LMC1 LMK1 ASV2934 LMN1

#write_rds(all_phy_psmelt_iso_BX_abundance, "../Output/II_Field_soils/all_phy_psmelt_iso_BX_abundance.rds")
ASV_WTbx1dif_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% selected_ASVs) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_WTbx1dif_OTU

ASV_abundance_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% selected_ASVs) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WT, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_abundance_OTU

all_phy_psmelt_iso_BX_abundance %<>% mutate(WTbx1dif_weigh_WT = WTbx1dif * WT)

ASV_weighed_BX_abundance_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% selected_ASVs) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = WTbx1dif_weigh_WT, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_weighed_BX_abundance_OTU

ASV_log2FC_OTU <-  all_phy_psmelt_iso_BX_abundance %>% filter(OTU %in% selected_ASVs) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("rhizo", "root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(y = log2FC, x = interaction(family, OTU))) + 
  geom_boxplot(aes(color = family)) +
  geom_jitter(aes(color=family), show.legend = TRUE) +
  geom_hline(yintercept = 0) +
  coord_flip() +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ compartment) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

ASV_log2FC_OTU

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(OTU %in% selected_ASVs) %>%  
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% c("LME3", "LMX9231", "LMZ1")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% c("LMN1")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% c("LAC11")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% c("LMC1", "LMK1")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% c("LML1")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter(width = 0.1)+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.8) +
  facet_wrap(family~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX_abundance %>% filter(compartment %in% c("rhizo", "root")) %>% filter(location %in% "Changins") %>% filter(family %in% c("Chitinophagaceae", "Deinococcaceae", "Moraxellaceae", "Nocardioidaceae", "Sphingobacteriaceae"))
## # A tibble: 720 × 16
##    OTU     rep phylum family genus location background compartment    bx1     WT
##    <chr> <dbl> <chr>  <chr>  <chr> <fct>    <fct>      <fct>        <dbl>  <dbl>
##  1 ASV2…     2 Bacte… Chiti… Chit… Changins B73        rhizo       0.0459 0     
##  2 ASV8…     7 Bacte… Chiti… Chit… Changins B73        rhizo       0      0.0179
##  3 ASV1…     8 Bacte… Chiti… Chit… Changins B73        rhizo       0      0     
##  4 ASV1…     1 Bacte… Chiti… Chit… Changins B73        rhizo       0      0     
##  5 ASV1…     3 Bacte… Chiti… Chit… Changins B73        rhizo       0      0     
##  6 ASV1…     5 Bacte… Chiti… Chit… Changins B73        root        0      0     
##  7 ASV1…     6 Bacte… Chiti… Chit… Changins B73        root        0      0     
##  8 ASV1…     6 Bacte… Chiti… Chit… Changins B73        rhizo       0      0     
##  9 ASV1…     7 Bacte… Chiti… Chit… Changins B73        rhizo       0      0     
## 10 ASV1…     3 Bacte… Chiti… Chit… Changins B73        root        0      0     
## # ℹ 710 more rows
## # ℹ 6 more variables: BXcol <dbl>, log2FC <dbl>, WTbx1dif <dbl>,
## #   WTbx1dif_zscore <dbl>, Strain <chr>, WTbx1dif_weigh_WT <dbl>
#write_rds(all_phy_psmelt_iso_BX_abundance_meanOTU, "../Output/II_Field_soils/all_phy_psmelt_iso_BX_abundance_meanOTU.rds")
all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(!family %in% c("Chitinophagaceae", "Deinococcaceae", "Moraxellaceae",  "Nocardioidaceae", "Sphingobacteriaceae", "Planococcaceae")) %>% 
  filter(compartment %in% "root") %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  # geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.1) +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(!family %in% c("Chitinophagaceae", "Deinococcaceae", "Moraxellaceae",  "Nocardioidaceae", "Sphingobacteriaceae", "Planococcaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(!family %in% c("Chitinophagaceae", "Deinococcaceae", "Moraxellaceae",  "Nocardioidaceae", "Sphingobacteriaceae", "Planococcaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()

only for well represented OTUs

all_phy_psmelt_iso_BX %>% filter(OTU %in% represented_OTU) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y = 4) +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ family) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

all_phy_psmelt_iso_BX %>% filter(OTU %in% represented_OTU) %>% 
  filter(Strain %in% strains) %>% 
  filter(compartment %in% c("root")) %>% 
  # filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  # mutate(log2FC = replace(log2FC, log2FC == -Inf, -5)) %>% 
  # mutate(log2FC = replace(log2FC, log2FC == Inf, 5)) %>% 
  # filter(!WTbx1dif  %in% 0) %>% 
  dplyr::select(-Strain) %>% 
  distinct() %>% 
  # filter(!log2FC %in% c(NA, NaN)) %>% 
  mutate(compartment = factor(compartment, levels = c("root", "rhizo") )) %>%
  mutate(OTU = reorder(OTU, desc(family))) %>% 
  # ggplot(aes(y = log2FC, x = reorder(interaction(family, OTU), desc(family)))) + 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  # geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y = 4) +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +f
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family)+
  facet_wrap(~ OTU) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

## # A tibble: 58 × 11
##    OTU    family .y.   group1 group2    n1    n2 statistic    df      p p.signif
##    <chr>  <chr>  <chr> <chr>  <chr>  <int> <int>     <dbl> <dbl>  <dbl> <chr>   
##  1 ASV100 Strep… Abun… WT     bx1       10     7   -0.139  14.5  0.891  ns      
##  2 ASV10… Rhizo… Abun… WT     bx1       10     7   -1.50    6.55 0.18   ns      
##  3 ASV10… Pseud… Abun… WT     bx1       10     7    1.33    9    0.217  ns      
##  4 ASV105 Micro… Abun… WT     bx1       10     7    0.644  14.6  0.53   ns      
##  5 ASV107 Burkh… Abun… WT     bx1       10     7   -0.786  12.4  0.447  ns      
##  6 ASV10… Micro… Abun… WT     bx1       10     7    0.399  15.0  0.696  ns      
##  7 ASV11… Bacil… Abun… WT     bx1       10     7    0.517   9.20 0.617  ns      
##  8 ASV12  Xanth… Abun… WT     bx1       10     7   -2.26    8.89 0.0507 ns      
##  9 ASV13… Strep… Abun… WT     bx1       10     7    1.25   11.7  0.237  ns      
## 10 ASV13… Bacil… Abun… WT     bx1       10     7    0.0874 12.9  0.932  ns      
## # ℹ 48 more rows
OTU family .y. group1 group2 n1 n2 statistic df p p.signif
ASV100 Streptomycetaceae Abundance WT bx1 10 7 -0.1392077 14.543635 0.8910 ns
ASV1000 Rhizobiaceae Abundance WT bx1 10 7 -1.5023458 6.549283 0.1800 ns
ASV1014 Pseudomonadaceae Abundance WT bx1 10 7 1.3283246 9.000000 0.2170 ns
ASV105 Micrococcaceae Abundance WT bx1 10 7 0.6436429 14.582456 0.5300 ns
ASV107 Burkholderiaceae Abundance WT bx1 10 7 -0.7857060 12.448290 0.4470 ns
ASV1078 Microbacteriaceae Abundance WT bx1 10 7 0.3989153 14.992563 0.6960 ns
ASV1182 Bacillaceae Abundance WT bx1 10 7 0.5168119 9.196489 0.6170 ns
ASV12 Xanthomonadaceae Abundance WT bx1 10 7 -2.2574405 8.889978 0.0507 ns
ASV1317 Streptomycetaceae Abundance WT bx1 10 7 1.2451919 11.743739 0.2370 ns
ASV1322 Bacillaceae Abundance WT bx1 10 7 0.0874425 12.893131 0.9320 ns
ASV1520 Burkholderiaceae Abundance WT bx1 10 7 0.5550099 12.378853 0.5890 ns
ASV1521 Streptomycetaceae Abundance WT bx1 10 7 0.9561018 12.248690 0.3580 ns
ASV159 Pseudomonadaceae Abundance WT bx1 10 7 0.5181715 14.863072 0.6120 ns
ASV1598 Microbacteriaceae Abundance WT bx1 10 7 0.8778713 12.874211 0.3960 ns
ASV1656 Burkholderiaceae Abundance WT bx1 10 7 -1.8921740 10.716893 0.0858 ns
ASV1708 Bacillaceae Abundance WT bx1 10 7 1.2475584 14.997160 0.2310 ns
ASV189 Pseudomonadaceae Abundance WT bx1 10 7 2.0702932 9.000000 0.0683 ns
ASV190 Enterobacteriaceae Abundance WT bx1 10 7 -2.0058910 6.000000 0.0917 ns
ASV2397 Streptomycetaceae Abundance WT bx1 10 7 1.1360517 9.120507 0.2850 ns
ASV247 Burkholderiaceae Abundance WT bx1 10 7 -1.0861733 14.367953 0.2950 ns
ASV2489 Bacillaceae Abundance WT bx1 10 7 0.6073955 14.661779 0.5530 ns
ASV2524 Streptomycetaceae Abundance WT bx1 10 7 1.2850607 10.853675 0.2260 ns
ASV2596 Streptomycetaceae Abundance WT bx1 10 7 -0.6733819 8.531024 0.5190 ns
ASV265 Streptomycetaceae Abundance WT bx1 10 7 -1.0905850 6.979829 0.3120 ns
ASV267 Burkholderiaceae Abundance WT bx1 10 7 -1.5440474 9.278433 0.1560 ns
ASV2957 Pseudomonadaceae Abundance WT bx1 10 7 1.5744765 9.000000 0.1500 ns
ASV3 Sphingomonadaceae Abundance WT bx1 10 7 -0.2024577 9.060357 0.8440 ns
ASV307 Pseudomonadaceae Abundance WT bx1 10 7 -1.6130220 6.000000 0.1580 ns
ASV31 Enterobacteriaceae Abundance WT bx1 10 7 0.8464223 9.708483 0.4180 ns
ASV33 Pseudomonadaceae Abundance WT bx1 10 7 -1.2126796 6.789729 0.2660 ns
ASV3305 Rhizobiaceae Abundance WT bx1 10 7 -1.7221028 6.000000 0.1360 ns
ASV340 Pseudomonadaceae Abundance WT bx1 10 7 -1.2898411 9.679773 0.2270 ns
ASV356 Burkholderiaceae Abundance WT bx1 10 7 -1.5992159 6.686604 0.1560 ns
ASV3604 Bacillaceae Abundance WT bx1 10 7 2.2829011 11.378419 0.0426 *
ASV382 Streptomycetaceae Abundance WT bx1 10 7 1.0820752 13.334704 0.2980 ns
ASV3840 Pseudomonadaceae Abundance WT bx1 10 7 -2.3688763 7.355095 0.0480 *
ASV4 Pseudomonadaceae Abundance WT bx1 10 7 -1.8692910 14.779464 0.0815 ns
ASV4167 Rhizobiaceae Abundance WT bx1 10 7 -1.5947171 6.000000 0.1620 ns
ASV429 Bacillaceae Abundance WT bx1 10 7 1.7571157 13.007608 0.1020 ns
ASV452 Burkholderiaceae Abundance WT bx1 10 7 -1.8269977 7.488471 0.1080 ns
ASV474 Enterobacteriaceae Abundance WT bx1 10 7 -1.0165833 6.009969 0.3490 ns
ASV4742 Bacillaceae Abundance WT bx1 10 7 0.8086108 14.938788 0.4310 ns
ASV49 Streptomycetaceae Abundance WT bx1 10 7 0.9840583 13.425266 0.3420 ns
ASV538 Streptomycetaceae Abundance WT bx1 10 7 0.5071189 10.571477 0.6220 ns
ASV54 Burkholderiaceae Abundance WT bx1 10 7 0.1915853 13.015987 0.8510 ns
ASV64 Streptomycetaceae Abundance WT bx1 10 7 -0.0158238 14.462151 0.9880 ns
ASV6737 Rhizobiaceae Abundance WT bx1 10 7 -1.8001242 6.000000 0.1220 ns
ASV7206 Microbacteriaceae Abundance WT bx1 10 7 0.3040182 14.555296 0.7650 ns
ASV784 Sphingomonadaceae Abundance WT bx1 10 7 -0.6731601 12.427637 0.5130 ns
ASV8 Rhizobiaceae Abundance WT bx1 10 7 -1.5899502 6.253949 0.1610 ns
ASV8270 Microbacteriaceae Abundance WT bx1 10 7 1.1474530 9.440767 0.2790 ns
ASV85 Enterobacteriaceae Abundance WT bx1 10 7 -0.9901076 6.018042 0.3600 ns
ASV883 Pseudomonadaceae Abundance WT bx1 10 7 1.7366280 9.000000 0.1160 ns
ASV914 Burkholderiaceae Abundance WT bx1 10 7 -0.8717046 8.814160 0.4060 ns
ASV917 Burkholderiaceae Abundance WT bx1 10 7 -0.2791383 12.895426 0.7850 ns
ASV968 Microbacteriaceae Abundance WT bx1 10 7 1.2847997 14.995394 0.2180 ns
ASV972 Micrococcaceae Abundance WT bx1 10 7 1.9028076 11.574134 0.0822 ns
ASV979 Pseudomonadaceae Abundance WT bx1 10 7 1.6930583 9.000000 0.1250 ns
all_phy_psmelt_iso_BX %>% filter(OTU %in% represented_OTU) %>% 
  filter(Strain %in% strains) %>% 
  dplyr::select(-Strain) %>% 
  filter(compartment %in% c("root")) %>% 
  filter(location %in% "Changins") %>% 
  filter(OTU %in% "ASV4") %>% 
  distinct() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT") +
  facet_wrap(~family, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  # scale_shape_manual(values=c(15, 16, 17, 18)) +
  scale_color_manual(values = all_phy_psmelt_iso_BX_abundance_meanOTU_level_cols_family) +
  facet_wrap(~ OTU) +
  #theme(axis.title.y = element_text(size = rel(0.5)))+
  labs(x = "",
       y = "WT - bx1",
       shape = "compartment")

Bacillaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Bacillaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Bacillaceae")

Burkholderiaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Burkholderiaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Burkholderiaceae")

Enterobacteriaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Enterobacteriaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Enterobacteriaceae")

Pseudomonadaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Pseudomonadaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Pseudomonadaceae")

Streptomycetaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Streptomycetaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()+
  labs(title = "Streptomycetaceae")

Spingomonadaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Sphingomonadaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw()+
  labs(title = "Sphingomonadaceae")

Rhizobiaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Rhizobiaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Rhizobiaceae")

Xanthomonadaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Xanthomonadaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Xanthomonadaceae")

Microbacteriaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Microbacteriaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Microbacteriaceae")

Micrococcaceae

all_phy_psmelt_iso_BX %>% filter(location %in% "Changins") %>%  
  filter(Strain %in% strains) %>% 
  filter(family %in% c("Micrococcaceae")) %>% 
  filter(compartment %in% "root") %>% 
  filter(Abundance > 0.1) %>% 
  dplyr::select(OTU, family, Abundance, genotype) %>% 
  unique() %>% 
  ggplot(aes(x=genotype, y = Abundance))+
  geom_bar(aes(fill = genotype), stat = "summary") +
  geom_jitter()+
  # stat_compare_means(method = "anova", aes(x = genotype, y = Abundance), label.y.npc = 0.02, label.x.npc = 0.6) +
  stat_compare_means(label = "p.signif", method = "t.test", ref.group = "WT", label.y.npc = 0.6) +
  facet_wrap(~OTU, scales = "free_y") +
  scale_fill_manual(values = c("gold", "forestgreen")) +
  theme_bw() +
  labs(title = "Micrococcaceae")

Cumulative field abundance isolates

sum all relative abundances in total of all represented ASVs

all_phy_psmelt_BX_abundance_meanOTU_mapped <- all_phy_psmelt_iso_BX_abundance_meanOTU %>% as.data.frame() %>% dplyr::select(-OTU, -Strain) %>% unique() 

all_phy_psmelt_mean <- all_phy_psmelt %>% 
  dplyr::select(-rep) %>% 
  group_by(OTU, compartment, location, background, genotype) %>% dplyr::summarise(mean_abundance = mean(Abundance))

# Total microbiome (no mapping)
total_abundance <- all_phy_psmelt_mean %>% 
  group_by(location, background, compartment, genotype) %>% 
  dplyr::summarise(sum_abundance = sum(mean_abundance)) # 99.96 % of the relative abundance

total_abundance_map_ASV <- all_phy_psmelt_BX_abundance_meanOTU_mapped %>% group_by(location, background, compartment) %>% 
  dplyr::summarise(sum_abundance = sum(WT_mean))

total_abundance_map_ASV_family <- all_phy_psmelt_BX_abundance_meanOTU_mapped %>% group_by(location, background, compartment, family) %>% 
  dplyr::summarise(sum_abundance = sum(WT_mean))


total_abundance_map_ASV_family %>% filter(family %in% "Pseudomonadaceae")
## # A tibble: 12 × 5
## # Groups:   location, background, compartment [12]
##    location  background compartment family           sum_abundance
##    <fct>     <fct>      <fct>       <chr>                    <dbl>
##  1 Changins  B73        rhizo       Pseudomonadaceae         2.12 
##  2 Changins  B73        root        Pseudomonadaceae         2.77 
##  3 Ithaca    W22        soil        Pseudomonadaceae         0.180
##  4 Ithaca    W22        rhizo       Pseudomonadaceae         0.727
##  5 Ithaca    W22        root        Pseudomonadaceae         1.83 
##  6 Zurich    B73        soil        Pseudomonadaceae         0    
##  7 Zurich    B73        rhizo       Pseudomonadaceae        25.8  
##  8 Zurich    B73        root        Pseudomonadaceae        19.3  
##  9 Zurich    W22        soil        Pseudomonadaceae         0    
## 10 Zurich    W22        rhizo       Pseudomonadaceae        12.2  
## 11 Zurich    W22        root        Pseudomonadaceae         9.29 
## 12 Sheffield W22        root        Pseudomonadaceae         0.506
total_abundance_map_ASV_family %>% filter(family %in% "Sphingomonadaceae")
## # A tibble: 12 × 5
## # Groups:   location, background, compartment [12]
##    location  background compartment family            sum_abundance
##    <fct>     <fct>      <fct>       <chr>                     <dbl>
##  1 Changins  B73        rhizo       Sphingomonadaceae        0.547 
##  2 Changins  B73        root        Sphingomonadaceae        0.701 
##  3 Ithaca    W22        soil        Sphingomonadaceae        1.47  
##  4 Ithaca    W22        rhizo       Sphingomonadaceae        6.94  
##  5 Ithaca    W22        root        Sphingomonadaceae        3.27  
##  6 Zurich    B73        soil        Sphingomonadaceae        0.0592
##  7 Zurich    B73        rhizo       Sphingomonadaceae        0.371 
##  8 Zurich    B73        root        Sphingomonadaceae        1.19  
##  9 Zurich    W22        soil        Sphingomonadaceae        0.0445
## 10 Zurich    W22        rhizo       Sphingomonadaceae        0.662 
## 11 Zurich    W22        root        Sphingomonadaceae        0.676 
## 12 Sheffield W22        root        Sphingomonadaceae        0
total_abundance_map_ASV_family %>% filter(location %in% "Changins") %>% filter(compartment %in% "root") %>% dplyr::arrange(desc(sum_abundance))
## # A tibble: 18 × 5
## # Groups:   location, background, compartment [1]
##    location background compartment family              sum_abundance
##    <fct>    <fct>      <fct>       <chr>                       <dbl>
##  1 Changins B73        root        Streptomycetaceae         14.2   
##  2 Changins B73        root        Oxalobacteraceae           5.22  
##  3 Changins B73        root        Pseudomonadaceae           2.77  
##  4 Changins B73        root        Bacillaceae                1.34  
##  5 Changins B73        root        Enterobacteriaceae         1.28  
##  6 Changins B73        root        Rhizobiaceae               0.919 
##  7 Changins B73        root        Sphingomonadaceae          0.701 
##  8 Changins B73        root        Microbacteriaceae          0.560 
##  9 Changins B73        root        Micrococcaceae             0.457 
## 10 Changins B73        root        Xanthomonadaceae           0.248 
## 11 Changins B73        root        Weeksellaceae              0.186 
## 12 Changins B73        root        Paenibacillaceae           0.0445
## 13 Changins B73        root        Chitinophagaceae           0     
## 14 Changins B73        root        Deinococcaceae             0     
## 15 Changins B73        root        Moraxellaceae              0     
## 16 Changins B73        root        Nocardioidaceae            0     
## 17 Changins B73        root        Planococcaceae             0     
## 18 Changins B73        root        Sphingobacteriaceae        0
total_abundance_map_ASV_family %>% filter(location %in% "Ithaca") %>% filter(compartment %in% "root") %>% dplyr::arrange(desc(sum_abundance))
## # A tibble: 18 × 5
## # Groups:   location, background, compartment [1]
##    location background compartment family              sum_abundance
##    <fct>    <fct>      <fct>       <chr>                       <dbl>
##  1 Ithaca   W22        root        Sphingomonadaceae         3.27   
##  2 Ithaca   W22        root        Streptomycetaceae         3.06   
##  3 Ithaca   W22        root        Enterobacteriaceae        2.87   
##  4 Ithaca   W22        root        Rhizobiaceae              2.27   
##  5 Ithaca   W22        root        Oxalobacteraceae          1.89   
##  6 Ithaca   W22        root        Pseudomonadaceae          1.83   
##  7 Ithaca   W22        root        Bacillaceae               0.764  
##  8 Ithaca   W22        root        Xanthomonadaceae          0.673  
##  9 Ithaca   W22        root        Microbacteriaceae         0.629  
## 10 Ithaca   W22        root        Micrococcaceae            0.249  
## 11 Ithaca   W22        root        Nocardioidaceae           0.0594 
## 12 Ithaca   W22        root        Weeksellaceae             0.0508 
## 13 Ithaca   W22        root        Chitinophagaceae          0.0321 
## 14 Ithaca   W22        root        Sphingobacteriaceae       0.00754
## 15 Ithaca   W22        root        Moraxellaceae             0.00754
## 16 Ithaca   W22        root        Deinococcaceae            0.00598
## 17 Ithaca   W22        root        Paenibacillaceae          0      
## 18 Ithaca   W22        root        Planococcaceae            0
total_abundance_map_ASV_family %>% filter(location %in% "Zurich") %>% filter(compartment %in% "root") %>% filter(background %in% "B73") %>%  dplyr::arrange(desc(sum_abundance))
## # A tibble: 18 × 5
## # Groups:   location, background, compartment [1]
##    location background compartment family              sum_abundance
##    <fct>    <fct>      <fct>       <chr>                       <dbl>
##  1 Zurich   B73        root        Pseudomonadaceae         19.3    
##  2 Zurich   B73        root        Enterobacteriaceae       13.6    
##  3 Zurich   B73        root        Oxalobacteraceae          4.53   
##  4 Zurich   B73        root        Xanthomonadaceae          3.60   
##  5 Zurich   B73        root        Rhizobiaceae              1.98   
##  6 Zurich   B73        root        Weeksellaceae             1.22   
##  7 Zurich   B73        root        Microbacteriaceae         1.21   
##  8 Zurich   B73        root        Sphingomonadaceae         1.19   
##  9 Zurich   B73        root        Micrococcaceae            0.361  
## 10 Zurich   B73        root        Sphingobacteriaceae       0.00772
## 11 Zurich   B73        root        Bacillaceae               0      
## 12 Zurich   B73        root        Chitinophagaceae          0      
## 13 Zurich   B73        root        Deinococcaceae            0      
## 14 Zurich   B73        root        Moraxellaceae             0      
## 15 Zurich   B73        root        Nocardioidaceae           0      
## 16 Zurich   B73        root        Paenibacillaceae          0      
## 17 Zurich   B73        root        Planococcaceae            0      
## 18 Zurich   B73        root        Streptomycetaceae         0
total_abundance_map_ASV_family %>% filter(location %in% "Sheffield") %>% filter(compartment %in% "root") %>%  dplyr::arrange(desc(sum_abundance))
## # A tibble: 18 × 5
## # Groups:   location, background, compartment [1]
##    location  background compartment family              sum_abundance
##    <fct>     <fct>      <fct>       <chr>                       <dbl>
##  1 Sheffield W22        root        Bacillaceae               2.16   
##  2 Sheffield W22        root        Micrococcaceae            0.989  
##  3 Sheffield W22        root        Oxalobacteraceae          0.871  
##  4 Sheffield W22        root        Streptomycetaceae         0.848  
##  5 Sheffield W22        root        Pseudomonadaceae          0.506  
##  6 Sheffield W22        root        Microbacteriaceae         0.387  
##  7 Sheffield W22        root        Paenibacillaceae          0.0841 
##  8 Sheffield W22        root        Weeksellaceae             0.0253 
##  9 Sheffield W22        root        Planococcaceae            0.0165 
## 10 Sheffield W22        root        Rhizobiaceae              0.0159 
## 11 Sheffield W22        root        Sphingobacteriaceae       0.0118 
## 12 Sheffield W22        root        Xanthomonadaceae          0.0102 
## 13 Sheffield W22        root        Chitinophagaceae          0.00491
## 14 Sheffield W22        root        Nocardioidaceae           0.00323
## 15 Sheffield W22        root        Enterobacteriaceae        0.00216
## 16 Sheffield W22        root        Deinococcaceae            0      
## 17 Sheffield W22        root        Moraxellaceae             0      
## 18 Sheffield W22        root        Sphingomonadaceae         0
total_abundance_map_ASV %>% knitr::kable()
location background compartment sum_abundance
Changins B73 rhizo 12.280359
Changins B73 root 27.899834
Ithaca W22 soil 3.964605
Ithaca W22 rhizo 13.465404
Ithaca W22 root 17.667511
Zurich B73 soil 2.598360
Zurich B73 rhizo 34.073580
Zurich B73 root 46.954111
Zurich W22 soil 1.047024
Zurich W22 rhizo 17.188441
Zurich W22 root 24.265725
Sheffield W22 root 5.937331
total_abundance_map_ASV_family %>% knitr::kable()
location background compartment family sum_abundance
Changins B73 rhizo Bacillaceae 0.3207786
Changins B73 rhizo Chitinophagaceae 0.0017877
Changins B73 rhizo Deinococcaceae 0.0000000
Changins B73 rhizo Enterobacteriaceae 0.1292595
Changins B73 rhizo Microbacteriaceae 0.2288258
Changins B73 rhizo Micrococcaceae 0.1427051
Changins B73 rhizo Moraxellaceae 0.0000000
Changins B73 rhizo Nocardioidaceae 0.0000000
Changins B73 rhizo Oxalobacteraceae 6.6779195
Changins B73 rhizo Paenibacillaceae 0.0000000
Changins B73 rhizo Planococcaceae 0.0000000
Changins B73 rhizo Pseudomonadaceae 2.1160741
Changins B73 rhizo Rhizobiaceae 0.2879899
Changins B73 rhizo Sphingobacteriaceae 0.0000000
Changins B73 rhizo Sphingomonadaceae 0.5472422
Changins B73 rhizo Streptomycetaceae 1.5650126
Changins B73 rhizo Weeksellaceae 0.1012386
Changins B73 rhizo Xanthomonadaceae 0.1615254
Changins B73 root Bacillaceae 1.3371543
Changins B73 root Chitinophagaceae 0.0000000
Changins B73 root Deinococcaceae 0.0000000
Changins B73 root Enterobacteriaceae 1.2832625
Changins B73 root Microbacteriaceae 0.5602443
Changins B73 root Micrococcaceae 0.4566919
Changins B73 root Moraxellaceae 0.0000000
Changins B73 root Nocardioidaceae 0.0000000
Changins B73 root Oxalobacteraceae 5.2240661
Changins B73 root Paenibacillaceae 0.0444960
Changins B73 root Planococcaceae 0.0000000
Changins B73 root Pseudomonadaceae 2.7664103
Changins B73 root Rhizobiaceae 0.9194660
Changins B73 root Sphingobacteriaceae 0.0000000
Changins B73 root Sphingomonadaceae 0.7008582
Changins B73 root Streptomycetaceae 14.1732563
Changins B73 root Weeksellaceae 0.1861579
Changins B73 root Xanthomonadaceae 0.2477699
Ithaca W22 soil Bacillaceae 0.2142960
Ithaca W22 soil Chitinophagaceae 0.0063491
Ithaca W22 soil Deinococcaceae 0.0000000
Ithaca W22 soil Enterobacteriaceae 0.0958395
Ithaca W22 soil Microbacteriaceae 0.0652384
Ithaca W22 soil Micrococcaceae 0.1796378
Ithaca W22 soil Moraxellaceae 0.0000000
Ithaca W22 soil Nocardioidaceae 0.0705006
Ithaca W22 soil Oxalobacteraceae 0.6441987
Ithaca W22 soil Paenibacillaceae 0.0000000
Ithaca W22 soil Planococcaceae 0.0000000
Ithaca W22 soil Pseudomonadaceae 0.1801450
Ithaca W22 soil Rhizobiaceae 0.1487701
Ithaca W22 soil Sphingobacteriaceae 0.0000000
Ithaca W22 soil Sphingomonadaceae 1.4670004
Ithaca W22 soil Streptomycetaceae 0.3441257
Ithaca W22 soil Weeksellaceae 0.1002449
Ithaca W22 soil Xanthomonadaceae 0.4482592
Ithaca W22 rhizo Bacillaceae 0.2300738
Ithaca W22 rhizo Chitinophagaceae 0.0432136
Ithaca W22 rhizo Deinococcaceae 0.0000000
Ithaca W22 rhizo Enterobacteriaceae 0.7816973
Ithaca W22 rhizo Microbacteriaceae 0.1105423
Ithaca W22 rhizo Micrococcaceae 0.0937915
Ithaca W22 rhizo Moraxellaceae 0.0000000
Ithaca W22 rhizo Nocardioidaceae 0.0171670
Ithaca W22 rhizo Oxalobacteraceae 2.7974533
Ithaca W22 rhizo Paenibacillaceae 0.0000000
Ithaca W22 rhizo Planococcaceae 0.0000000
Ithaca W22 rhizo Pseudomonadaceae 0.7271583
Ithaca W22 rhizo Rhizobiaceae 0.5021250
Ithaca W22 rhizo Sphingobacteriaceae 0.0000000
Ithaca W22 rhizo Sphingomonadaceae 6.9419814
Ithaca W22 rhizo Streptomycetaceae 0.1030512
Ithaca W22 rhizo Weeksellaceae 0.1257927
Ithaca W22 rhizo Xanthomonadaceae 0.9913563
Ithaca W22 root Bacillaceae 0.7635971
Ithaca W22 root Chitinophagaceae 0.0321239
Ithaca W22 root Deinococcaceae 0.0059848
Ithaca W22 root Enterobacteriaceae 2.8746736
Ithaca W22 root Microbacteriaceae 0.6290434
Ithaca W22 root Micrococcaceae 0.2486621
Ithaca W22 root Moraxellaceae 0.0075401
Ithaca W22 root Nocardioidaceae 0.0593715
Ithaca W22 root Oxalobacteraceae 1.8942871
Ithaca W22 root Paenibacillaceae 0.0000000
Ithaca W22 root Planococcaceae 0.0000000
Ithaca W22 root Pseudomonadaceae 1.8272373
Ithaca W22 root Rhizobiaceae 2.2701051
Ithaca W22 root Sphingobacteriaceae 0.0075401
Ithaca W22 root Sphingomonadaceae 3.2679302
Ithaca W22 root Streptomycetaceae 3.0553280
Ithaca W22 root Weeksellaceae 0.0508397
Ithaca W22 root Xanthomonadaceae 0.6732469
Zurich B73 soil Bacillaceae 0.0000000
Zurich B73 soil Chitinophagaceae 0.0000000
Zurich B73 soil Deinococcaceae 0.0000000
Zurich B73 soil Enterobacteriaceae 0.0000000
Zurich B73 soil Microbacteriaceae 0.0000000
Zurich B73 soil Micrococcaceae 0.3898240
Zurich B73 soil Moraxellaceae 0.0000000
Zurich B73 soil Nocardioidaceae 0.0000000
Zurich B73 soil Oxalobacteraceae 1.5261891
Zurich B73 soil Paenibacillaceae 0.0000000
Zurich B73 soil Planococcaceae 0.0000000
Zurich B73 soil Pseudomonadaceae 0.0000000
Zurich B73 soil Rhizobiaceae 0.0000000
Zurich B73 soil Sphingobacteriaceae 0.0000000
Zurich B73 soil Sphingomonadaceae 0.0592192
Zurich B73 soil Streptomycetaceae 0.5105346
Zurich B73 soil Weeksellaceae 0.0310713
Zurich B73 soil Xanthomonadaceae 0.0815217
Zurich B73 rhizo Bacillaceae 0.1898894
Zurich B73 rhizo Chitinophagaceae 0.0047197
Zurich B73 rhizo Deinococcaceae 0.0000000
Zurich B73 rhizo Enterobacteriaceae 0.7215536
Zurich B73 rhizo Microbacteriaceae 0.1998122
Zurich B73 rhizo Micrococcaceae 2.1926300
Zurich B73 rhizo Moraxellaceae 0.0000000
Zurich B73 rhizo Nocardioidaceae 0.0000000
Zurich B73 rhizo Oxalobacteraceae 1.3956039
Zurich B73 rhizo Paenibacillaceae 0.0000000
Zurich B73 rhizo Planococcaceae 0.0000000
Zurich B73 rhizo Pseudomonadaceae 25.7652630
Zurich B73 rhizo Rhizobiaceae 1.0453470
Zurich B73 rhizo Sphingobacteriaceae 0.0000000
Zurich B73 rhizo Sphingomonadaceae 0.3709773
Zurich B73 rhizo Streptomycetaceae 0.0000000
Zurich B73 rhizo Weeksellaceae 1.8244830
Zurich B73 rhizo Xanthomonadaceae 0.3633009
Zurich B73 root Bacillaceae 0.0000000
Zurich B73 root Chitinophagaceae 0.0000000
Zurich B73 root Deinococcaceae 0.0000000
Zurich B73 root Enterobacteriaceae 13.5671680
Zurich B73 root Microbacteriaceae 1.2066201
Zurich B73 root Micrococcaceae 0.3605178
Zurich B73 root Moraxellaceae 0.0000000
Zurich B73 root Nocardioidaceae 0.0000000
Zurich B73 root Oxalobacteraceae 4.5271340
Zurich B73 root Paenibacillaceae 0.0000000
Zurich B73 root Planococcaceae 0.0000000
Zurich B73 root Pseudomonadaceae 19.2990819
Zurich B73 root Rhizobiaceae 1.9816359
Zurich B73 root Sphingobacteriaceae 0.0077196
Zurich B73 root Sphingomonadaceae 1.1889132
Zurich B73 root Streptomycetaceae 0.0000000
Zurich B73 root Weeksellaceae 1.2172809
Zurich B73 root Xanthomonadaceae 3.5980395
Zurich W22 soil Bacillaceae 0.0000000
Zurich W22 soil Chitinophagaceae 0.0000000
Zurich W22 soil Deinococcaceae 0.0000000
Zurich W22 soil Enterobacteriaceae 0.0345662
Zurich W22 soil Microbacteriaceae 0.0000000
Zurich W22 soil Micrococcaceae 0.2097291
Zurich W22 soil Moraxellaceae 0.0000000
Zurich W22 soil Nocardioidaceae 0.0000000
Zurich W22 soil Oxalobacteraceae 0.5582531
Zurich W22 soil Paenibacillaceae 0.0000000
Zurich W22 soil Planococcaceae 0.0000000
Zurich W22 soil Pseudomonadaceae 0.0000000
Zurich W22 soil Rhizobiaceae 0.0268848
Zurich W22 soil Sphingobacteriaceae 0.0000000
Zurich W22 soil Sphingomonadaceae 0.0444825
Zurich W22 soil Streptomycetaceae 0.0000000
Zurich W22 soil Weeksellaceae 0.0714083
Zurich W22 soil Xanthomonadaceae 0.1016998
Zurich W22 rhizo Bacillaceae 0.1141118
Zurich W22 rhizo Chitinophagaceae 0.0000000
Zurich W22 rhizo Deinococcaceae 0.0000000
Zurich W22 rhizo Enterobacteriaceae 0.2134681
Zurich W22 rhizo Microbacteriaceae 0.0401601
Zurich W22 rhizo Micrococcaceae 1.2586269
Zurich W22 rhizo Moraxellaceae 0.0000000
Zurich W22 rhizo Nocardioidaceae 0.0000000
Zurich W22 rhizo Oxalobacteraceae 0.6575196
Zurich W22 rhizo Paenibacillaceae 0.0000000
Zurich W22 rhizo Planococcaceae 0.0000000
Zurich W22 rhizo Pseudomonadaceae 12.1959143
Zurich W22 rhizo Rhizobiaceae 0.7645875
Zurich W22 rhizo Sphingobacteriaceae 0.0000000
Zurich W22 rhizo Sphingomonadaceae 0.6621182
Zurich W22 rhizo Streptomycetaceae 0.0000000
Zurich W22 rhizo Weeksellaceae 0.7271068
Zurich W22 rhizo Xanthomonadaceae 0.5548279
Zurich W22 root Bacillaceae 0.0000000
Zurich W22 root Chitinophagaceae 0.0000000
Zurich W22 root Deinococcaceae 0.0000000
Zurich W22 root Enterobacteriaceae 7.4779797
Zurich W22 root Microbacteriaceae 0.4565680
Zurich W22 root Micrococcaceae 0.2197740
Zurich W22 root Moraxellaceae 0.0000000
Zurich W22 root Nocardioidaceae 0.0000000
Zurich W22 root Oxalobacteraceae 2.7327661
Zurich W22 root Paenibacillaceae 0.0000000
Zurich W22 root Planococcaceae 0.0000000
Zurich W22 root Pseudomonadaceae 9.2871568
Zurich W22 root Rhizobiaceae 0.8094188
Zurich W22 root Sphingobacteriaceae 0.0000000
Zurich W22 root Sphingomonadaceae 0.6755531
Zurich W22 root Streptomycetaceae 0.0000000
Zurich W22 root Weeksellaceae 0.7146973
Zurich W22 root Xanthomonadaceae 1.8918109
Sheffield W22 root Bacillaceae 2.1620284
Sheffield W22 root Chitinophagaceae 0.0049149
Sheffield W22 root Deinococcaceae 0.0000000
Sheffield W22 root Enterobacteriaceae 0.0021627
Sheffield W22 root Microbacteriaceae 0.3868906
Sheffield W22 root Micrococcaceae 0.9893794
Sheffield W22 root Moraxellaceae 0.0000000
Sheffield W22 root Nocardioidaceae 0.0032314
Sheffield W22 root Oxalobacteraceae 0.8706924
Sheffield W22 root Paenibacillaceae 0.0840896
Sheffield W22 root Planococcaceae 0.0165003
Sheffield W22 root Pseudomonadaceae 0.5059968
Sheffield W22 root Rhizobiaceae 0.0158535
Sheffield W22 root Sphingobacteriaceae 0.0117742
Sheffield W22 root Sphingomonadaceae 0.0000000
Sheffield W22 root Streptomycetaceae 0.8482652
Sheffield W22 root Weeksellaceae 0.0253353
Sheffield W22 root Xanthomonadaceae 0.0102160
# count_sample_ASV <- all_phy_psmelt_iso_BX %>% filter(!Abundance %in% 0) %>% dplyr::select(OTU, rep, background, compartment, genotype, location, family) %>% group_by(OTU, background, compartment, genotype, location, family)  %>% unique() %>% count()
# 
# count_sample_ASV %>% filter(OTU %in% "ASV2230")
# 
# count_sample_ASV_well_represented <- count_sample_ASV %>% filter(location %in% "Changins") %>% filter(compartment %in% "root") %>%  filter(n > 2)
# represented_OTU <- count_sample_ASV_well_represented$OTU %>% unique()
all_phy_psmelt_iso_BX_abundance %>% dplyr::select(-Strain) %>% unique()
## # A tibble: 100,860 × 15
##    OTU      rep phylum  family genus location background compartment   bx1    WT
##    <chr>  <dbl> <chr>   <chr>  <chr> <fct>    <fct>      <fct>       <dbl> <dbl>
##  1 ASV31      9 Proteo… Enter… Ente… Zurich   W22        root         9.86   0  
##  2 ASV4       1 Proteo… Pseud… Pseu… Zurich   B73        rhizo        5.59  15.5
##  3 ASV31     11 Proteo… Enter… Ente… Zurich   W22        root        14.7    0  
##  4 ASV190     1 Proteo… Enter… Lell… Zurich   W22        root         5.45  14.7
##  5 ASV190     7 Proteo… Enter… Lell… Zurich   B73        root         2.56  14.3
##  6 ASV4      11 Proteo… Pseud… Pseu… Zurich   B73        rhizo        9.09  14.2
##  7 ASV4       5 Proteo… Pseud… Pseu… Zurich   W22        rhizo        0     13.8
##  8 ASV4       8 Proteo… Pseud… Pseu… Zurich   B73        rhizo       10.4   13.7
##  9 ASV4       6 Proteo… Pseud… Pseu… Zurich   B73        rhizo        4.28  13.4
## 10 ASV4       3 Proteo… Pseud… Pseu… Zurich   B73        rhizo       13.3   12.3
## # ℹ 100,850 more rows
## # ℹ 5 more variables: BXcol <dbl>, log2FC <dbl>, WTbx1dif <dbl>,
## #   WTbx1dif_zscore <dbl>, WTbx1dif_weigh_WT <dbl>

Ranks of the isolates in the microbiome

all_phy_psmelt_rank <- all_phy_psmelt %>% dplyr::select(OTU, family, background, location, compartment, genotype, Abundance) %>%  mutate(background_location_compartment_genotype = interaction(background, location, compartment, genotype, sep = "_")) %>% filter(!genotype %in% c("bx2", "bx6"))

all_phy_psmelt_rank_wide <- all_phy_psmelt_rank %>% 
  dplyr::select(-background, -location, -compartment, -genotype) %>% 
  group_by(OTU, family, background_location_compartment_genotype) %>% 
  dplyr::summarize(Abundance_mean = mean(Abundance)) %>% 
  pivot_wider(names_from = background_location_compartment_genotype, values_from = Abundance_mean)

all_phy_psmelt_rank_wide_r <- all_phy_psmelt_rank_wide %>% arrange(., desc(B73_Changins_root_WT))
all_phy_psmelt_rank_wide_r$rank_B73_Changins_root_WT <- c(1:nrow(all_phy_psmelt_rank_wide_r))

all_phy_psmelt_rank_wide_r <- all_phy_psmelt_rank_wide_r %>% arrange(., desc(B73_Changins_root_bx1))
all_phy_psmelt_rank_wide_r$rank_B73_Changins_root_bx1 <- c(1:nrow(all_phy_psmelt_rank_wide_r))

all_phy_psmelt_rank_OTU <- all_phy_psmelt_rank_wide_r %>%
  dplyr::select(OTU, family, B73_Changins_root_WT, B73_Changins_root_bx1, rank_B73_Changins_root_WT, rank_B73_Changins_root_bx1) %>% mutate(rankdif_WTbx1 = rank_B73_Changins_root_bx1 - rank_B73_Changins_root_WT)

#write_rds(all_phy_psmelt_rank_OTU, "../Output/II_Field_soils/ll_phy_psmelt_rank_OTU.rds")

all_phy_psmelt_rank_OTU_iso <- left_join(all_phy_psmelt_rank_OTU, iso.tab, by = c("OTU" = "ASV")) 
#write_rds(all_phy_psmelt_rank_OTU_iso, "../Output/II_Field_soils/all_phy_psmelt_rank_OTU_iso.rds")